lorekeeper 1.4.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -14
- data/Rakefile +7 -0
- data/lib/lorekeeper/fast_logger.rb +1 -1
- data/lib/lorekeeper/json_logger.rb +13 -1
- data/lib/lorekeeper/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb86c0771b8af2bb376144477a152548c2045c21
|
4
|
+
data.tar.gz: aa6f2652e7b62b2b8a926d6b201866c3d1a79d8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb18f9197c45fbca068de878cad2e793dc0280abdebb4e3bd275f3cbf8ffd03439bcac110afd232cf8485b611ea72a392e17d7afb663311d1789383467608fc3
|
7
|
+
data.tar.gz: a127bb23bcc346fce93614dfff11c054e5b0f2ae5f2da51b058b1b87fb45450773c5030f4ee896dee07c2275cc110a9fef1ffd545c9521bcaa0b12e4d518719c
|
data/CHANGELOG.md
CHANGED
@@ -1,29 +1,33 @@
|
|
1
|
-
# 1.
|
2
|
-
|
1
|
+
# 1.5.0
|
2
|
+
Adds exception method to simple logger so it can be used as default in
|
3
|
+
gems, specs, etc.
|
3
4
|
|
4
5
|
# 1.4.0
|
5
|
-
|
6
|
-
|
6
|
+
Adds '_with_data' to the simple logger so we can display data in the
|
7
|
+
terminal
|
8
|
+
Adds 'respond_to?' to the multilogger so users can check capabilities of
|
9
|
+
the loggers
|
7
10
|
|
8
11
|
# 1.3.1
|
9
|
-
|
12
|
+
Loggers provide an inspect method to avoid being too noisy on outputs
|
10
13
|
|
11
14
|
# 1.3.0
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
+
Time in the JSON output specifies microseconds.
|
16
|
+
Using 'Z' to specify the UTC timezone instead of +0000 as per ISO 8601.
|
17
|
+
Debug and Info messages use the default foreground color of the terminal.
|
15
18
|
|
16
19
|
# 1.2.1
|
17
|
-
|
20
|
+
If a file does not exist, it will create it on behalf of the application
|
18
21
|
|
19
22
|
# 1.2
|
20
|
-
|
21
|
-
|
23
|
+
Added a silence_logger method to the logger. For compatibility with
|
24
|
+
activerecord-session and maybe other gems.
|
22
25
|
# 1.1.1
|
23
|
-
|
26
|
+
Avoid syntax errors in rubies < 2.3
|
24
27
|
|
25
28
|
# 1.1.0
|
26
|
-
|
29
|
+
Added an 'add' method to the logger so it is compatible with the Logger
|
30
|
+
provided by Ruby's standard library
|
27
31
|
|
28
32
|
# 1.0.0
|
29
|
-
|
33
|
+
Initial release
|
data/Rakefile
CHANGED
@@ -48,6 +48,13 @@ task :benchmark do
|
|
48
48
|
|
49
49
|
log = create_logger
|
50
50
|
simple_log = create_simple_logger
|
51
|
+
Benchmark.ips do |bm|
|
52
|
+
bm.report('short content') { Time.now }
|
53
|
+
bm.report('Logger short content') { Time.now.utc }
|
54
|
+
bm.report('long content') { Time.now.strftime('%FT%T.%6NZ') }
|
55
|
+
bm.report('Logger long content') { Time.now.utc.strftime('%FT%T.%6NZ') }
|
56
|
+
bm.compare!
|
57
|
+
end
|
51
58
|
|
52
59
|
Benchmark.ips do |bm|
|
53
60
|
bm.report('short content') { log.error(contents) }
|
@@ -21,7 +21,7 @@ module Lorekeeper
|
|
21
21
|
@file = file # We only keep this so we can inspect where we are sending the logs
|
22
22
|
end
|
23
23
|
|
24
|
-
LOGGING_METHODS =
|
24
|
+
LOGGING_METHODS = %i(debug info warn error fatal)
|
25
25
|
METHOD_SEVERITY_MAP = { debug: DEBUG, info: INFO, warn: WARN, error: ERROR, fatal: FATAL }
|
26
26
|
|
27
27
|
# We define the behaviour of all the usual logging methods
|
@@ -152,7 +152,19 @@ module Lorekeeper
|
|
152
152
|
log_data(METHOD_SEVERITY_MAP[method_name], "#{message_param}, data: #{data}")
|
153
153
|
end
|
154
154
|
end
|
155
|
-
end
|
156
155
|
|
156
|
+
# TODO: move this to fast_logger so we DRY it
|
157
|
+
def exception(exception, custom_message = nil, custom_data = nil)
|
158
|
+
if exception.is_a?(Exception)
|
159
|
+
backtrace = exception.backtrace || []
|
160
|
+
message = custom_message || exception.message
|
161
|
+
error_with_data("#{exception.class}: #{message}", backtrace.join("\n"))
|
162
|
+
else
|
163
|
+
log_data(:warning, 'Logger exception called without exception class.')
|
164
|
+
error_with_data("#{exception.class}: #{exception.inspect} #{custom_message}", custom_data)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
end
|
157
169
|
|
158
170
|
end
|
data/lib/lorekeeper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lorekeeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordi Polo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -171,3 +171,4 @@ signing_key:
|
|
171
171
|
specification_version: 4
|
172
172
|
summary: Very fast JSON logger
|
173
173
|
test_files: []
|
174
|
+
has_rdoc:
|