Module: Logrithm
- Defined in:
- lib/logrithm.rb,
lib/logrithm.rb,
lib/logrithm/log.rb,
lib/logrithm/version.rb,
lib/logrithm/utils/color.rb,
lib/logrithm/utils/output.rb,
lib/logrithm/utils/helpers.rb,
lib/logrithm/utils/syringe.rb,
lib/logrithm/middleware/rack.rb,
lib/logrithm/spitters/string.rb,
lib/logrithm/formatters/pretty.rb,
lib/logrithm/formatters/default.rb,
lib/logrithm/spitters/exception.rb
Overview
rubocop:disable Style/GlobalVars
Defined Under Namespace
Modules: Formatters, Middleware, Spitters, Utils
Classes: Log
Constant Summary
collapse
- VERSION =
'0.2.2'
Class Method Summary
collapse
Class Method Details
.color(severity) ⇒ Object
54
55
56
|
# File 'lib/logrithm.rb', line 54
def color(severity)
Log::INSTANCE.send(:color, severity)
end
|
.env ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/logrithm.rb', line 17
def env
case
when ENV['LOGRITHM_ENV'] then ENV['LOGRITHM_ENV'].to_sym
when rails? then Rails.env
else :development
end
end
|
.rails? ⇒ Boolean
12
13
14
|
# File 'lib/logrithm.rb', line 12
def rails?
Kernel.const_defined?('::Rails')
end
|
.severity(severity) ⇒ Object
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/logrithm.rb', line 26
def severity(severity)
case severity.to_s.upcase
when 'DEBUG', '0' then 0
when 'INFO', '1' then 1
when 'WARN', '2' then 2
when 'ERROR', '3' then 3
when 'FATAL', '4' then 4
else 2
end
end
|