test_quick_logger 0.1.0 → 0.7.1
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/README.md +3 -3
- data/lib/test_quick_logger/controller_methods.rb +1 -1
- data/lib/test_quick_logger/railtie.rb +2 -0
- data/lib/test_quick_logger/version.rb +1 -1
- data/lib/test_quick_logger.rb +14 -14
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b27ad2352b7c62fefc95ffcd456b00ee38a2c94905fbdeadc6930a73996dc990
|
4
|
+
data.tar.gz: 1defb7d27a175c380fd5a6c71e0b7a85719cb6a063d4402ddcd68b6d46067f0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c693acccf4308a0c8ae5a2edd5a445c554c413c9e4327a35667b748a3af72d2c04d44a9dda0f499946823559b6d80abf8f6228f057911a3736ea651d89d7fc84
|
7
|
+
data.tar.gz: 2dde2b148cadda1546900b735433ab48f5d00da6486643306a32e697ac5a93af06552831865781a56cf589b120af902f4f8fdab722975be7d6b6d3a93386415c
|
data/README.md
CHANGED
@@ -6,15 +6,15 @@ Welcome to your new gem! In this directory, you'll find the files you need to be
|
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
-
TODO: Replace `
|
9
|
+
TODO: Replace `custom_logger` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
10
10
|
|
11
11
|
Install the gem and add to the application's Gemfile by executing:
|
12
12
|
|
13
|
-
$ bundle add
|
13
|
+
$ bundle add custom_logger
|
14
14
|
|
15
15
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
16
16
|
|
17
|
-
$ gem install
|
17
|
+
$ gem install custom_logger
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
@@ -2,6 +2,6 @@ module TestQuickLogger::ControllerMethods
|
|
2
2
|
def logit
|
3
3
|
return unless user_signed_in?
|
4
4
|
|
5
|
-
TestQuickLogger.info("[#{current_user}] #{request.method.upcase} #{request.path}")
|
5
|
+
TestQuickLogger.info("\e[95m[#{current_user.username}] \e[33m#{request.method.upcase}\e[0m #{request.path}")
|
6
6
|
end
|
7
7
|
end
|
data/lib/test_quick_logger.rb
CHANGED
@@ -2,44 +2,44 @@
|
|
2
2
|
|
3
3
|
require_relative "test_quick_logger/version"
|
4
4
|
require_relative "test_quick_logger/controller_methods"
|
5
|
-
require_relative "
|
5
|
+
require_relative "test_quick_logger/railtie" if defined?(Rails)
|
6
6
|
|
7
7
|
module TestQuickLogger
|
8
8
|
class Error < StandardError; end
|
9
9
|
module_function
|
10
10
|
|
11
11
|
COLORS = {
|
12
|
-
debug: "\e[
|
13
|
-
info: "\e[
|
14
|
-
warn: "\e[
|
12
|
+
debug: "\e[90m",
|
13
|
+
info: "\e[96m",
|
14
|
+
warn: "\e[93m",
|
15
15
|
error: "\e[31m",
|
16
16
|
}
|
17
17
|
|
18
18
|
def instance
|
19
|
-
@instance ||= ::
|
19
|
+
@instance ||= ::ActiveSupport::Logger.new("log/custom.log")
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
23
|
-
Time.current.in_time_zone("Mountain Time (US & Canada)").strftime("[%b %d, %I:%M:%S%P]")
|
24
|
-
end
|
25
|
-
|
26
|
-
def logit(level, message)
|
22
|
+
def pretty_log(level, message)
|
27
23
|
instance.send(level, "\e[90m#{timestamp}#{COLORS[level]}[#{level.to_s[0].upcase}]\e[0m #{message}")
|
28
24
|
end
|
29
25
|
|
30
26
|
def debug(message)
|
31
|
-
|
27
|
+
pretty_log(:debug, message)
|
32
28
|
end
|
33
29
|
|
34
30
|
def info(message)
|
35
|
-
|
31
|
+
pretty_log(:info, message)
|
36
32
|
end
|
37
33
|
|
38
34
|
def warn(message)
|
39
|
-
|
35
|
+
pretty_log(:warn, message)
|
40
36
|
end
|
41
37
|
|
42
38
|
def error(message)
|
43
|
-
|
39
|
+
pretty_log(:error, message)
|
40
|
+
end
|
41
|
+
|
42
|
+
def timestamp
|
43
|
+
Time.current.in_time_zone("Mountain Time (US & Canada)").strftime("[%b %d, %I:%M:%S%P]")
|
44
44
|
end
|
45
45
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_quick_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.7.1
|
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
|
-
description:
|
13
|
+
description: https://github.com
|
14
14
|
email:
|
15
15
|
- rocco11nicholls@gmail.com
|
16
16
|
executables: []
|
@@ -29,11 +29,11 @@ files:
|
|
29
29
|
- lib/test_quick_logger/railtie.rb
|
30
30
|
- lib/test_quick_logger/version.rb
|
31
31
|
- sig/test_quick_logger.rbs
|
32
|
-
homepage: https://github.com
|
32
|
+
homepage: https://github.com/repo/custom-logger
|
33
33
|
licenses:
|
34
34
|
- MIT
|
35
35
|
metadata:
|
36
|
-
homepage_uri: https://github.com
|
36
|
+
homepage_uri: https://github.com/repo/custom-logger
|
37
37
|
source_code_uri: https://github.com
|
38
38
|
changelog_uri: https://github.com
|
39
39
|
post_install_message:
|
@@ -54,5 +54,5 @@ requirements: []
|
|
54
54
|
rubygems_version: 3.4.1
|
55
55
|
signing_key:
|
56
56
|
specification_version: 4
|
57
|
-
summary:
|
57
|
+
summary: https://github.com
|
58
58
|
test_files: []
|