Class: LoggerFactory
- Inherits:
-
Object
- Object
- LoggerFactory
- Defined in:
- logger_factory.rb
Overview
Looks within _config.yml for a key corresponding to the plugin progname. For example, if the plugin’s progname has value “abc” then an entry called logger_factory.abc will be read from the config file, if present. If the entry exists, its value overrides the value specified when create_logger() was called. If no such entry is found then the log_level value specified when create_logger() was called is used.
For more information about the logging feature in the Ruby standard library,
Instance Method Summary collapse
Instance Method Details
#create_logger(progname, config, log_level, stream_name) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'logger_factory.rb', line 33 def create_logger(progname, config, log_level, stream_name) config_log_level = check_config_log_level(config: config, progname: progname) logger = Logger.new(stream_name) logger.level = config_log_level || log_level logger.progname = progname logger.formatter = proc { |severity, _, prog_name, msg| "#{severity} #{prog_name}: #{msg}\n" } logger end |