lite_logger 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +17 -1
- data/lib/lite_logger/logger.rb +3 -2
- data/lib/lite_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: 1444c01d8b611aae058133582a232840dc14712a898eca0fdc5695f21e6025bf
|
4
|
+
data.tar.gz: 8af0639ebfabc5bfbbca2da242a126509d81fefacd72adc9f4161ac56d1531f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60b622783d0ac193c3c09587dd91c1a5358d95f1f3ed568722c9d3e1a41025bc80c623c001d5c2ef633f212d35fe5dee4b8bbd3f200b90d1c791d405a82625d5
|
7
|
+
data.tar.gz: 2c38a22345a42046c969d17834c4c7e4bbdbd85b84a9fe3bf5d1e3e3718279bd3cc087eb4bfe52a8415c09965717a6017ede54ba408eba234426a009480f55c3
|
data/CHANGELOG.md
CHANGED
@@ -22,3 +22,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
22
22
|
## [0.1.3] - 2024-06-12
|
23
23
|
|
24
24
|
- Added missing log/ directory that was causing the specs to fail.
|
25
|
+
|
26
|
+
## [0.1.4] - 2024-07-09
|
27
|
+
|
28
|
+
- Remove duplicated call to `Time.now`
|
29
|
+
|
30
|
+
## [0.1.5] - 2024-07-10
|
31
|
+
|
32
|
+
- Bug fix: Remove uninitialized constant LiteLogger::Logger::StringIO
|
33
|
+
- Readme updated with example on how to log to a file.
|
data/README.md
CHANGED
@@ -30,7 +30,7 @@ gem install lite_logger
|
|
30
30
|
|
31
31
|
### Example
|
32
32
|
|
33
|
-
In a Ruby class:
|
33
|
+
#### In a Ruby class:
|
34
34
|
|
35
35
|
```ruby
|
36
36
|
# Require the gem
|
@@ -54,6 +54,22 @@ class MyClass
|
|
54
54
|
end
|
55
55
|
```
|
56
56
|
|
57
|
+
#### Logging to a file
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
require 'lite_logger'
|
61
|
+
|
62
|
+
@logger = LiteLogger::Logger.new
|
63
|
+
@logger.destination = './application.log'
|
64
|
+
@logger.info('Application started!')
|
65
|
+
```
|
66
|
+
|
67
|
+
Output:
|
68
|
+
|
69
|
+
```
|
70
|
+
2024-07-10 18:58:07 -0300 [INFO] Application started!
|
71
|
+
```
|
72
|
+
|
57
73
|
## Contributing
|
58
74
|
|
59
75
|
Bug reports and pull requests are welcome: <https://github.com/dmferrari/lite_logger/pulls>.
|
data/lib/lite_logger/logger.rb
CHANGED
@@ -28,11 +28,12 @@ module LiteLogger
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def format_message(level, message)
|
31
|
+
current_time = Time.now
|
31
32
|
case @format
|
32
33
|
when :json
|
33
|
-
{ level: level, message: message, timestamp:
|
34
|
+
{ level: level, message: message, timestamp: current_time }.to_json
|
34
35
|
else
|
35
|
-
"#{
|
36
|
+
"#{current_time} [#{level.upcase}] #{message}"
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
data/lib/lite_logger/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lite_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Ferrari
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|