Class: LoggerFacade::Plugins::Base
- Inherits:
-
Object
- Object
- LoggerFacade::Plugins::Base
show all
- Defined in:
- lib/logger_facade/plugins/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
-
#debug(logger, message, metadata: {}) ⇒ Object
-
#error(logger, message, metadata: {}) ⇒ Object
-
#info(logger, message, metadata: {}) ⇒ Object
-
#initialize(name, config = nil) ⇒ Base
constructor
-
#is_debug ⇒ Object
-
#trace(logger, message, metadata: {}) ⇒ Object
-
#warn(logger, message, metadata: {}) ⇒ Object
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
#config ⇒ Object
Returns the value of attribute config.
5
6
7
|
# File 'lib/logger_facade/plugins/base.rb', line 5
def config
@config
end
|
#level ⇒ Object
Returns the value of attribute level.
5
6
7
|
# File 'lib/logger_facade/plugins/base.rb', line 5
def level
@level
end
|
#name ⇒ Object
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, metadata)
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, metadata)
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, metadata)
end
|
#is_debug ⇒ Object
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, metadata)
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, metadata)
end
|