/// <summary> /// Construct an instance of AWSLogger /// </summary> /// <param name="categoryName">The category name for the logger which can be used for filtering.</param> /// <param name="core">The core logger that is used to send messages to AWS.</param> /// <param name="filter">Filter function that will only allow messages to be sent to AWS if it returns true. If the value is null all messages are sent.</param> /// <param name="customFormatter">A custom formatter which accepts a LogLevel, a state, and an exception and returns the formatted log message.</param> public AWSLogger(string categoryName, IAWSLoggerCore core, Func <string, LogLevel, bool> filter, Func <LogLevel, object, Exception, string> customFormatter = null) { _categoryName = categoryName; _core = core; _filter = filter; _customFormatter = customFormatter; }
/// <summary> /// Creates the logging provider with the configuration information to connect to AWS and how the messages should be sent. /// </summary> /// <param name="config">Configuration on how to connect to AWS and how the log messages should be sent.</param> /// <param name="filter">A filter function that has the logger category name and log level which can be used to filter messages being sent to AWS.</param> /// <param name="formatter">A custom formatter which accepts a LogLevel, a state, and an exception and returns the formatted log message.</param> public AWSLoggerProvider(AWSLoggerConfig config, Func <string, LogLevel, bool> filter, Func <LogLevel, object, Exception, string> formatter = null) { _scopeProvider = NullExternalScopeProvider.Instance; _core = new AWSLoggerCore(config, "ILogger"); _customFilter = filter; _customFormatter = formatter; }
/// <summary> /// Construct an instance of AWSLogger /// </summary> /// <param name="categoryName">The category name for the logger which can be used for filtering.</param> /// <param name="core">The core logger that is used to send messages to AWS.</param> /// <param name="filter">Filter function that will only allow messages to be sent to AWS if it returns true. If the value is null all messages are sent.</param> /// <param name="customFormatter">A custom formatter which accepts a LogLevel, a state, and an exception and returns the formatted log message.</param> public AWSLogger(string categoryName, IAWSLoggerCore core, Func <string, LogLevel, bool> filter, Func <LogLevel, object, Exception, string> customFormatter = null) { _categoryName = categoryName; _core = core; _filter = filter; _customFormatter = customFormatter; // This is done in the constructor to ensure the logic in the setter is run during initialization. this.IncludeScopes = Constants.IncludeScopesDefault; }
/// <summary> /// Creates the logging provider with the configuration section information to connect to AWS and how the messages should be sent. Also contains the LogLevel details /// </summary> /// <param name="configSection">Contains configuration on how to connect to AWS and how the log messages should be sent. Also contains the LogeLevel details based upon which the filter values would be set</param> public AWSLoggerProvider(IAmazonCloudWatchLogs client, AWSLoggerConfigSection configSection) { _configSection = configSection; _core = new AWSLoggerCore(client, _configSection.Config, "ILogger"); }
/// <summary> /// Creates the logging provider with the configuration information to connect to AWS and how the messages should be sent. /// </summary> /// <param name="config">Configuration on how to connect to AWS and how the log messages should be sent.</param> /// <param name="filter">A filter function that has the logger category name and log level which can be used to filter messages being sent to AWS.</param> public AWSLoggerProvider(IAmazonCloudWatchLogs client, AWSLoggerConfig config, Func <string, LogLevel, bool> filter) { _core = new AWSLoggerCore(client, config, "ILogger"); _filter = filter; }
/// <summary> /// Creates the logging provider with the configuration section information to connect to AWS and how the messages should be sent. Also contains the LogLevel details /// </summary> /// <param name="configSection">Contains configuration on how to connect to AWS and how the log messages should be sent. Also contains the LogeLevel details based upon which the filter values would be set</param> public AWSLoggerProvider(AWSLoggerConfigSection configSection) { _configSection = configSection; _core = new AWSLoggerCore(_configSection.Config, "ILogger"); }
/// <summary> /// Creates the logging provider with the configuration information to connect to AWS and how the messages should be sent. /// </summary> /// <param name="config">Configuration on how to connect to AWS and how the log messages should be sent.</param> /// <param name="filter">A filter function that has the logger category name and log level which can be used to filter messages being sent to AWS.</param> /// <param name="formatter">A custom formatter which accepts a LogLevel, a state, and an exception and returns the formatted log message.</param> public AWSLoggerProvider(AWSLoggerConfig config, Func <string, LogLevel, bool> filter, Func <LogLevel, object, Exception, string> formatter = null) { _core = new AWSLoggerCore(config, "ILogger"); _filter = filter; _customFormatter = formatter; }
/// <summary> /// Creates the logging provider with the configuration section information to connect to AWS and how the messages should be sent. Also contains the LogLevel details /// </summary> /// <param name="configSection">Contains configuration on how to connect to AWS and how the log messages should be sent. Also contains the LogeLevel details based upon which the filter values would be set</param> public AWSLoggerProvider(AWSLoggerConfigSection configSection) { _scopeProvider = configSection.IncludeScopes ? new LoggerExternalScopeProvider() : NullExternalScopeProvider.Instance; _configSection = configSection; _core = new AWSLoggerCore(_configSection.Config, "ILogger"); }
/// <summary> /// Construct an instance of AWSLogger /// </summary> /// <param name="categoryName">The category name for the logger which can be used for filtering.</param> /// <param name="core">The core logger that is used to send messages to AWS.</param> /// <param name="filter">Filter function that will only allow messages to be sent to AWS if it returns true. If the value is null all messages are sent.</param> public AWSLogger(string categoryName, IAWSLoggerCore core, Func <string, LogLevel, bool> filter) { _categoryName = categoryName; _core = core; _filter = filter; }
/// <summary> /// Creates the logging provider with the configuration information to connect to AWS and how the messages should be sent. /// </summary> /// <param name="config">Configuration on how to connect to AWS and how the log messages should be sent.</param> /// <param name="filter">A filter function that has the logger category name and log level which can be used to filter messages being sent to AWS.</param> public AWSLoggerProvider(AWSLoggerConfig config, Func <string, LogLevel, bool> filter) { _core = new AWSLoggerCore(config, "ILogger"); _filter = filter; }