Class: LoggerFacade::Plugins::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/logger_facade/plugins/base.rb

Direct Known Subclasses

Airbrake, Console, Logstash

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, config = nil) ⇒ Base

Returns a new instance of Base.



7
8
9
10
11
# File 'lib/logger_facade/plugins/base.rb', line 7

def initialize(name, config = nil)
  @config = Hashie::Mash.new(config)
  @level = (@config.level || :debug).to_sym
  @name = name
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



5
6
7
# File 'lib/logger_facade/plugins/base.rb', line 5

def config
  @config
end

#levelObject (readonly)

Returns the value of attribute level.



5
6
7
# File 'lib/logger_facade/plugins/base.rb', line 5

def level
  @level
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/logger_facade/plugins/base.rb', line 5

def name
  @name
end

Instance Method Details

#debug(logger, message, metadata: {}) ⇒ Object



21
22
23
# File 'lib/logger_facade/plugins/base.rb', line 21

def debug(logger, message, metadata: {})
  log(:debug, message, logger, )
end

#error(logger, message, metadata: {}) ⇒ Object



33
34
35
# File 'lib/logger_facade/plugins/base.rb', line 33

def error(logger, message, metadata: {})
  log(:error, message, logger, )
end

#info(logger, message, metadata: {}) ⇒ Object



25
26
27
# File 'lib/logger_facade/plugins/base.rb', line 25

def info(logger, message, metadata: {})
  log(:info, message, logger, )
end

#is_debugObject



13
14
15
# File 'lib/logger_facade/plugins/base.rb', line 13

def is_debug
  is_level_active(:debug)
end

#trace(logger, message, metadata: {}) ⇒ Object



17
18
19
# File 'lib/logger_facade/plugins/base.rb', line 17

def trace(logger, message, metadata: {})
  log(:trace, message, logger, )
end

#warn(logger, message, metadata: {}) ⇒ Object



29
30
31
# File 'lib/logger_facade/plugins/base.rb', line 29

def warn(logger, message, metadata: {})
  log(:warn, message, logger, )
end