pretty_logger 1.2.3 → 1.3.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 +16 -4
- data/lib/pretty_logger/railtie.rb +2 -0
- data/lib/pretty_logger/version.rb +2 -2
- 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: a22a9e42e046d57b54de0ea5f42eed2258843cfe6aa5e946692db317b3737418
|
4
|
+
data.tar.gz: 141180fbc2a6614c08a8ddb929d09f191fb367c292fc22335708b13a87dd37cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea715b57ed726091dd9bed662e3916d8ef0a55d1a0d80b91626de56f94c701e914c0efb9003e0579959a954d0df0b7ec9828dda84846af85515a9bdf3b0f528f
|
7
|
+
data.tar.gz: 5ec7936a4569ca088ef2e4887a2ed931a71f7913aca640e531d7af191ad9d2f77d198f79e68f36cb851344bb84df4fb8e5c09ebb2f4b8172c6fd0f1c57d9a2e2
|
@@ -1,6 +1,13 @@
|
|
1
1
|
module PrettyLogger
|
2
2
|
module_function
|
3
3
|
|
4
|
+
COLORS = {
|
5
|
+
debug: "\e[90m",
|
6
|
+
info: "\e[96m",
|
7
|
+
warn: "\e[93m",
|
8
|
+
error: "\e[31m",
|
9
|
+
}
|
10
|
+
|
4
11
|
def instance
|
5
12
|
@instance ||= ::ActiveSupport::Logger.new("log/custom.log")
|
6
13
|
end
|
@@ -19,20 +26,25 @@ module PrettyLogger
|
|
19
26
|
)
|
20
27
|
end
|
21
28
|
|
29
|
+
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[0].upcase}]\e[0m #{message}")
|
32
|
+
end
|
33
|
+
|
22
34
|
def debug(*messages)
|
23
|
-
|
35
|
+
pretty_log(:debug, *messages)
|
24
36
|
end
|
25
37
|
|
26
38
|
def info(*messages)
|
27
|
-
|
39
|
+
pretty_log(:info, *messages)
|
28
40
|
end
|
29
41
|
|
30
42
|
def warn(*messages)
|
31
|
-
|
43
|
+
pretty_log(:warn, *messages)
|
32
44
|
end
|
33
45
|
|
34
46
|
def error(*messages)
|
35
|
-
|
47
|
+
pretty_log(:error, *messages)
|
36
48
|
end
|
37
49
|
|
38
50
|
def cl
|
@@ -3,6 +3,8 @@ module PrettyLogger
|
|
3
3
|
initializer "pretty_logger.configure_rails_initialization" do
|
4
4
|
ActiveSupport.on_load(:action_controller) do
|
5
5
|
include PrettyLogger::ControllerMethods
|
6
|
+
|
7
|
+
before_action :pretty_logit
|
6
8
|
rescue_from ::StandardError, with: :prettylog_and_reraise!
|
7
9
|
end
|
8
10
|
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = "1.
|
1
|
+
module PrettyLogger
|
2
|
+
VERSION = "1.3.0"
|
3
3
|
end
|
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.3.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-05-
|
11
|
+
date: 2024-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coderay
|