Class: Lokilogger::Logger
- Inherits:
-
Object
- Object
- Lokilogger::Logger
show all
- Includes:
- Severity
- Defined in:
- lib/lokilogger.rb
Constant Summary
Constants included
from Severity
Severity::DEBUG, Severity::ERROR, Severity::FATAL, Severity::INFO, Severity::UNKNOWN, Severity::WARN
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Severity
coerce
Constructor Details
#initialize(config) ⇒ Logger
Returns a new instance of Logger.
Instance Attribute Details
Returns the value of attribute formatter.
35
36
37
|
# File 'lib/lokilogger.rb', line 35
def formatter
@formatter
end
|
Instance Method Details
31
32
33
|
# File 'lib/lokilogger.rb', line 31
def datetime_format
@default_formatter.datetime_format
end
|
27
28
29
|
# File 'lib/lokilogger.rb', line 27
def datetime_format= datetime_format
@default_formatter.datetime_format = datetime_format
end
|
#debug(*args) ⇒ Object
37
38
39
|
# File 'lib/lokilogger.rb', line 37
def debug(*args)
message "debug", args
end
|
#debug! ⇒ Object
45
46
47
|
# File 'lib/lokilogger.rb', line 45
def debug!
@client.log_level = DEBUG
end
|
#debug? ⇒ Boolean
41
42
43
|
# File 'lib/lokilogger.rb', line 41
def debug?
@client.log_level <= DEBUG
end
|
#error(*args) ⇒ Object
73
74
75
|
# File 'lib/lokilogger.rb', line 73
def error(*args)
message "error", args
end
|
#error! ⇒ Object
81
82
83
|
# File 'lib/lokilogger.rb', line 81
def error!
@client.log_level = ERROR
end
|
#error? ⇒ Boolean
77
78
79
|
# File 'lib/lokilogger.rb', line 77
def error?
@client.log_level <= ERROR
end
|
#fatal(*args) ⇒ Object
85
86
87
|
# File 'lib/lokilogger.rb', line 85
def fatal(*args)
message "fatal", args
end
|
#fatal! ⇒ Object
93
94
95
|
# File 'lib/lokilogger.rb', line 93
def fatal!
@client.log_level = FATAL
end
|
#fatal? ⇒ Boolean
89
90
91
|
# File 'lib/lokilogger.rb', line 89
def fatal?
@client.log_level <= FATAL
end
|
#info(*args) ⇒ Object
49
50
51
|
# File 'lib/lokilogger.rb', line 49
def info(*args)
message "info", args
end
|
#info! ⇒ Object
57
58
59
|
# File 'lib/lokilogger.rb', line 57
def info!
@client.log_level = INFO
end
|
#info? ⇒ Boolean
53
54
55
|
# File 'lib/lokilogger.rb', line 53
def info?
@client.log_level <= INFO
end
|
#level ⇒ Object
113
114
115
|
# File 'lib/lokilogger.rb', line 113
def level
@client.log_level
end
|
#level=(severity) ⇒ Object
109
110
111
|
# File 'lib/lokilogger.rb', line 109
def level= severity
@client.log_level = Severity.coerce severity
end
|
#message(severity, *args) ⇒ Object
117
118
119
120
121
122
|
# File 'lib/lokilogger.rb', line 117
def message(severity, *args)
message = args[0][0]
= args[0][1] if args[0].count > 1
@client.request severity, message,
end
|
#unknown(*args) ⇒ Object
97
98
99
|
# File 'lib/lokilogger.rb', line 97
def unknown(*args)
message "unknown", args
end
|
#unknown! ⇒ Object
105
106
107
|
# File 'lib/lokilogger.rb', line 105
def unknown!
@client.log_level = UNKNOWN
end
|
#unknown? ⇒ Boolean
101
102
103
|
# File 'lib/lokilogger.rb', line 101
def unknown?
@client.log_level <= UNKNOWN
end
|
#warn(*args) ⇒ Object
61
62
63
|
# File 'lib/lokilogger.rb', line 61
def warn(*args)
message "warn", args
end
|
#warn! ⇒ Object
69
70
71
|
# File 'lib/lokilogger.rb', line 69
def warn!
@client.log_level = WARN
end
|
#warn? ⇒ Boolean
65
66
67
|
# File 'lib/lokilogger.rb', line 65
def warn?
@client.log_level <= WARN
end
|