Module: Plogger
- Extended by:
- Plogger
- Included in:
- Plogger
- Defined in:
- lib/plogger.rb,
lib/plogger/config.rb,
lib/plogger/handler.rb,
lib/plogger/version.rb,
lib/plogger/formatter.rb,
lib/plogger/id_generator.rb
Defined Under Namespace
Classes: Config, Formatter, Handler, IdGenerator
Constant Summary
collapse
- VERSION =
"0.9.1"
Instance Method Summary
collapse
-
#config ⇒ Object
-
#configure {|config| ... } ⇒ Object
-
#debug(message, type: 'system', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
-
#error(message, type: 'system', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
-
#exception(exception, type: 'system', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
-
#info(message, type: 'system', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
-
#logger ⇒ Object
-
#warn(message, type: 'system', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
Instance Method Details
#config ⇒ Object
13
14
15
|
# File 'lib/plogger.rb', line 13
def config
@@config ||= Plogger::Config.new(logger)
end
|
17
18
19
20
21
|
# File 'lib/plogger.rb', line 17
def configure
yield(config)
@@logger = config.logger
@@config = config
end
|
#debug(message, type: 'system', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
47
48
49
50
51
|
# File 'lib/plogger.rb', line 47
def debug(message, type: 'system', category: '', user_id: '', account_id: '', extra_info: {})
handler = Plogger::Handler.new(config)
handler.handle_debug(message, category: category, user_id: user_id, account_id: account_id,
extra_info: )
end
|
#error(message, type: 'system', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
29
30
31
32
33
|
# File 'lib/plogger.rb', line 29
def error(message, type: 'system', category: '', user_id: '', account_id: '', extra_info: {})
handler = Plogger::Handler.new(config)
handler.handle_error(message, category: category, user_id: user_id, account_id: account_id,
extra_info: )
end
|
#exception(exception, type: 'system', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
23
24
25
26
27
|
# File 'lib/plogger.rb', line 23
def exception(exception, type: 'system', category: '', user_id: '', account_id: '', extra_info: {})
handler = Plogger::Handler.new(config)
handler.handle_exception(exception, category: category, user_id: user_id, account_id: account_id,
extra_info: )
end
|
#info(message, type: 'system', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
41
42
43
44
45
|
# File 'lib/plogger.rb', line 41
def info(message, type: 'system', category: '', user_id: '', account_id: '', extra_info: {})
handler = Plogger::Handler.new(config)
handler.handle_info(message, category: category, user_id: user_id, account_id: account_id,
extra_info: )
end
|
#logger ⇒ Object
9
10
11
|
# File 'lib/plogger.rb', line 9
def logger
@@logger ||= defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
end
|
#warn(message, type: 'system', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
35
36
37
38
39
|
# File 'lib/plogger.rb', line 35
def warn(message, type: 'system', category: '', user_id: '', account_id: '', extra_info: {})
handler = Plogger::Handler.new(config)
handler.handle_warning(message, category: category, user_id: user_id, account_id: account_id,
extra_info: )
end
|