Class: RubySmart::SimpleLogger::Logger
- Inherits:
-
Logger
- Object
- Logger
- RubySmart::SimpleLogger::Logger
- Includes:
- ActionView::Helpers::DateHelper, Extensions::Helper, Extensions::Logs, Extensions::Mask, Extensions::Processed, Extensions::Scene, Extensions::Severity, Extensions::SimpleLog, Extensions::Timer, Scenes
- Defined in:
- lib/ruby_smart/simple_logger/logger.rb
Constant Summary collapse
- PAYLOAD_DATA_KEY =
defines a uniq key to parse the data
:__data__
Instance Attribute Summary collapse
-
#logdev ⇒ Object
readonly
enable access to the logdev.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Logger
constructor
initializes a new Logger.
-
#level=(sev) ⇒ Object
overwrite level setter, to accept every available (also newly defined) Severity.
-
#log_stats ⇒ Hash
included
from Extensions::Logs
returns a hash with total amounts per logged type (key).
-
#logs ⇒ Array
included
from Extensions::Logs
returns the logdev logs.
-
#logs_to_h ⇒ Hash
included
from Extensions::Logs
transforms the logs-array into a hash of logs, grouped by level (:error, :success, ...).
- #timer(action, key = :default, opts = {}) ⇒ Object included from Extensions::Timer
Constructor Details
#initialize(*args) ⇒ Logger
initializes a new Logger
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/ruby_smart/simple_logger/logger.rb', line 49 def initialize(*args) opts = args.last.is_a?(Hash) ? args.pop : {} opts[:builtin] = args if args.length > 0 # enhance options with device & formatter _opts_device!(opts) _opts_formatter!(opts) # initialize & set defaults by provided opts _opts_init!(opts) # initialize with a nil +logdev+ to prevent any nested +LogDevice+ creation. # we already arranged device & formatter to be able to respond to ther required methods super(nil) # set explicit after called super self.level = opts[:level] self.formatter = opts[:formatter] @logdev = _logdev(opts) end |
Instance Attribute Details
#logdev ⇒ Object (readonly)
enable access to the logdev
39 40 41 |
# File 'lib/ruby_smart/simple_logger/logger.rb', line 39 def logdev @logdev end |
Instance Method Details
#level=(sev) ⇒ Object
overwrite level setter, to accept every available (also newly defined) Severity
72 73 74 |
# File 'lib/ruby_smart/simple_logger/logger.rb', line 72 def level=(sev) @level = _level(sev) end |
#log_stats ⇒ Hash Originally defined in module Extensions::Logs
returns a hash with total amounts per logged type (key)
#logs ⇒ Array Originally defined in module Extensions::Logs
returns the logdev logs
#logs_to_h ⇒ Hash Originally defined in module Extensions::Logs
transforms the logs-array into a hash of logs, grouped by level (:error, :success, ...)