Class: Doing::Logger
Overview
Log adapter
Constant Summary collapse
- TOPIC_WIDTH =
12
- LOG_LEVELS =
{ debug: ::Logger::DEBUG, info: ::Logger::INFO, warn: ::Logger::WARN, error: ::Logger::ERROR }.freeze
- COUNT_KEYS =
%i[ added added_tags archived autotag completed completed_archived deleted moved removed_tags rotated skipped updated exported ].freeze
Instance Attribute Summary collapse
-
#level ⇒ Object
readonly
Returns the current log level (debug, info, warn, error).
-
#logdev ⇒ Object
writeonly
Sets the log device.
-
#max_length ⇒ Object
writeonly
Max length of log messages (truncate in middle).
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
-
#abort_with(topic, message = nil, &block) ⇒ Object
Print an error message and immediately abort the process.
- #adjust_verbosity(options = {}) ⇒ Object
- #benchmark(key, state) ⇒ Object
- #count(key, level: :info, count: 1, tag: nil, message: nil) ⇒ Object
-
#debug(topic, message = nil, &block) ⇒ Object
Print a debug message.
-
#error(topic, message = nil, &block) ⇒ Object
Print an error message.
-
#formatted_topic(topic, colon: false) ⇒ Object
Format the topic.
-
#info(topic, message = nil, &block) ⇒ Object
Print a message.
-
#initialize(level = :info) ⇒ Logger
constructor
Create a new instance of a log writer.
- #log_benchmarks ⇒ Object
- #log_change(tags_added: [], tags_removed: [], count: 1, item: nil, single: false) ⇒ Object
-
#log_level=(level = 'info') ⇒ Object
Set the log level on the writer.
-
#log_now(level, topic, message = nil, &block) ⇒ Object
Log to console immediately instead of writing messages on exit.
-
#output_results ⇒ Object
Output registers based on log level.
-
#restore_level ⇒ Object
Restore temporary level.
-
#temp_level(level) ⇒ Object
Set log level temporarily.
-
#warn(topic, message = nil, &block) ⇒ Object
Print a message.
-
#write(level_of_message, topic, message = nil, &block) ⇒ Boolean
Log a message.
Constructor Details
#initialize(level = :info) ⇒ Logger
Create a new instance of a log writer
Instance Attribute Details
#level ⇒ Object (readonly)
Returns the current log level (debug, info, warn, error)
#logdev=(value) ⇒ Object (writeonly)
Sets the log device
#max_length=(value) ⇒ Object (writeonly)
Max length of log messages (truncate in middle)
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
#results ⇒ Object (readonly)
Returns the value of attribute results.
Instance Method Details
#abort_with(topic, message = nil, &block) ⇒ Object
Print an error message and immediately abort the process
#adjust_verbosity(options = {}) ⇒ Object
#benchmark(key, state) ⇒ Object
#count(key, level: :info, count: 1, tag: nil, message: nil) ⇒ Object
#debug(topic, message = nil, &block) ⇒ Object
Print a debug message
#error(topic, message = nil, &block) ⇒ Object
Print an error message
#formatted_topic(topic, colon: false) ⇒ Object
Format the topic
#info(topic, message = nil, &block) ⇒ Object
Print a message
#log_benchmarks ⇒ Object
#log_change(tags_added: [], tags_removed: [], count: 1, item: nil, single: false) ⇒ Object
#log_level=(level = 'info') ⇒ Object
Set the log level on the writer
#log_now(level, topic, message = nil, &block) ⇒ Object
Log to console immediately instead of writing messages on exit
#output_results ⇒ Object
Output registers based on log level
#restore_level ⇒ Object
Restore temporary level
#temp_level(level) ⇒ Object
Set log level temporarily
#warn(topic, message = nil, &block) ⇒ Object
Print a message
#write(level_of_message, topic, message = nil, &block) ⇒ Boolean
Log a message.