Class: Logsaber::Log
- Inherits:
-
Object
- Object
- Logsaber::Log
- Defined in:
- lib/logsaber/log.rb
Instance Attribute Summary collapse
-
#appname ⇒ Object
Returns the value of attribute appname.
-
#formatter ⇒ Object
Returns the value of attribute formatter.
-
#level ⇒ Object
Returns the value of attribute level.
-
#output ⇒ Object
Returns the value of attribute output.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(output, level, appname, formatter) ⇒ Log
constructor
A new instance of Log.
Constructor Details
#initialize(output, level, appname, formatter) ⇒ Log
Returns a new instance of Log.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/logsaber/log.rb', line 19 def initialize output, level, appname, formatter self.output = output @level = level.to_sym @appname = appname @formatter = formatter.set_log self unless SEVERITY_LEVELS.include? @level then raise "Invalid level: #{level.inspect}.\nUse one of: #{SEVERITY_LEVELS}" end end |
Instance Attribute Details
#appname ⇒ Object
Returns the value of attribute appname.
30 31 32 |
# File 'lib/logsaber/log.rb', line 30 def appname @appname end |
#formatter ⇒ Object
Returns the value of attribute formatter.
30 31 32 |
# File 'lib/logsaber/log.rb', line 30 def formatter @formatter end |
#level ⇒ Object
Returns the value of attribute level.
30 31 32 |
# File 'lib/logsaber/log.rb', line 30 def level @level end |
#output ⇒ Object
Returns the value of attribute output.
30 31 32 |
# File 'lib/logsaber/log.rb', line 30 def output @output end |
Class Method Details
.create(*args) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/logsaber/log.rb', line 4 def create *args = { output: $stdout, level: :info, appname: nil, formatter: Logsaber::Formatter.new } = Options.extract_from args, , :output self.new * end |