Class: Legion::Logging::Logger
- Inherits:
-
Object
- Object
- Legion::Logging::Logger
- Defined in:
- lib/legion/logging/logger.rb
Constant Summary
Constants included from Methods
Methods::COMPONENT_REGEX, Methods::EXCEPTION_PRIORITY
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#extended ⇒ Object
Returns the value of attribute extended.
-
#level ⇒ Object
Returns the value of attribute level.
-
#lex ⇒ Object
Returns the value of attribute lex.
-
#log ⇒ Object
Returns the value of attribute log.
-
#log_file ⇒ Object
Returns the value of attribute log_file.
-
#trace_enabled ⇒ Object
Returns the value of attribute trace_enabled.
Instance Method Summary collapse
-
#initialize(level: 'info', log_file: nil, log_stdout: nil, lex: nil, trace: false, extended: false, trace_size: 4, format: :text, async: false, **opts) ⇒ Logger
constructor
A new instance of Logger.
Methods included from Builder
#async?, #build_runner_trace, #json?, #json_format, #log_format, #log_level, #output, #prepare_log_path, #resolve_lex_tag, #set_log, #start_async_writer, #stop_async_writer, #text_format
Methods included from Methods
#debug, #emit_tagged, #error, #fatal, #info, #log_exception, #runner_exception, #thread, #trace, #unknown, #warn
Constructor Details
#initialize(level: 'info', log_file: nil, log_stdout: nil, lex: nil, trace: false, extended: false, trace_size: 4, format: :text, async: false, **opts) ⇒ Logger
Returns a new instance of Logger.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/legion/logging/logger.rb', line 14 def initialize(level: 'info', log_file: nil, log_stdout: nil, lex: nil, trace: false, extended: false, trace_size: 4, format: :text, async: false, **opts) @lex = lex set_log(logfile: log_file, log_stdout: log_stdout) log_level(level) log_format(format: format, lex: lex, extended: extended, **opts) @color = opts[:color] @color = format != :json && (opts[:color] || (opts[:color].nil? && log_file.nil?)) @trace_enabled = trace @trace_size = trace_size @extended = extended start_async_writer if async end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
9 10 11 |
# File 'lib/legion/logging/logger.rb', line 9 def color @color end |
#extended ⇒ Object
Returns the value of attribute extended.
9 10 11 |
# File 'lib/legion/logging/logger.rb', line 9 def extended @extended end |
#level ⇒ Object
Returns the value of attribute level.
9 10 11 |
# File 'lib/legion/logging/logger.rb', line 9 def level @level end |
#lex ⇒ Object
Returns the value of attribute lex.
9 10 11 |
# File 'lib/legion/logging/logger.rb', line 9 def lex @lex end |
#log ⇒ Object
Returns the value of attribute log.
9 10 11 |
# File 'lib/legion/logging/logger.rb', line 9 def log @log end |
#log_file ⇒ Object
Returns the value of attribute log_file.
9 10 11 |
# File 'lib/legion/logging/logger.rb', line 9 def log_file @log_file end |
#trace_enabled ⇒ Object
Returns the value of attribute trace_enabled.
9 10 11 |
# File 'lib/legion/logging/logger.rb', line 9 def trace_enabled @trace_enabled end |