pretty_logger 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pretty_logger/pretty_logger.rb +6 -3
- data/lib/pretty_logger/request_logger.rb +2 -2
- data/lib/pretty_logger/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2ae9a51880dc6ebb9500c2affdd64c28c874025c1f9ad1361dc48217e1b34a9
|
4
|
+
data.tar.gz: 27bced28aad91c65a9265a7e5c3d8a280c939b621c41a7bf84b3bf307650f079
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 942d017acc10359adfc6f317e752a80f85e1aa90d4f01685a58cf40e328e5b67aab2cd2a3eb24e26d5d8a9dc1164db52ffd89e0df44307bf8a50c3966ef0503e
|
7
|
+
data.tar.gz: 1596dce1df092a1d481f65578c06746ab00918dbc2b39b6c389eaefb0a59ab17b354c4e44d7f75db419befa13891e41d54fa3eef2f25d318d9bcf217e053ba15
|
@@ -23,12 +23,15 @@ module PrettyLogger
|
|
23
23
|
/\e\[36m:(\w+)\e\[0m=>/i, ("\e[36m" + '\1: ' + "\e[0m") # hashrocket(sym) to colon(sym)
|
24
24
|
).gsub(
|
25
25
|
/\e\[0m=>/, "\e[0m: " # all hashrockets to colons
|
26
|
+
).gsub(
|
27
|
+
# grey out nils
|
28
|
+
"\e[1;36mnil\e[0m", "\e[1;90mnil\e[0m"
|
26
29
|
)
|
27
30
|
end
|
28
31
|
|
29
32
|
def pretty_log(level, *messages)
|
30
|
-
message = messages.map { |m| pretty_message(m) }.join("\n")
|
31
|
-
instance.send(level, "\e[90m#{timestamp}#{COLORS[level]}[#{level.to_s
|
33
|
+
message = messages.compact.map { |m| pretty_message(m) }.join("\n")
|
34
|
+
instance.send(level, "\e[90m#{timestamp}#{COLORS[level]}[#{level.to_s.upcase}]\e[0m#{message}")
|
32
35
|
end
|
33
36
|
|
34
37
|
def debug(*messages)
|
@@ -36,7 +39,7 @@ module PrettyLogger
|
|
36
39
|
end
|
37
40
|
|
38
41
|
def info(*messages)
|
39
|
-
pretty_log(
|
42
|
+
pretty_log(nil, *messages) # nil makes it so `info` level doesn't show a prefix
|
40
43
|
end
|
41
44
|
|
42
45
|
def warn(*messages)
|
@@ -9,8 +9,8 @@ class PrettyLogger::RequestLogger
|
|
9
9
|
|
10
10
|
def log_request(extra_text=nil)
|
11
11
|
info([
|
12
|
-
"#{pretty_user} #{request.method.upcase} #{request.path} #{extra_text}",
|
13
|
-
params.blank? ? nil : truncate(pretty_message(params)),
|
12
|
+
"#{pretty_user} #{request.method.upcase} #{request.path} #{extra_text}\e[0m",
|
13
|
+
params.blank? ? nil : truncate(pretty_message(params.to_unsafe_h.deep_symbolize_keys)),
|
14
14
|
].compact.join("\n"))
|
15
15
|
end
|
16
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pretty_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rocco Nicholls
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coderay
|