mr_loga_loga 0.1.2 → 0.1.3
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/.codeclimate.yml +2 -0
- data/.github/workflows/release.yml +1 -1
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/README.md +6 -3
- data/lib/mr_loga_loga/formatters/json.rb +3 -3
- data/lib/mr_loga_loga/instance_methods.rb +2 -0
- data/lib/mr_loga_loga/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f131fea9745ad602c462f8b79aedd2a6e921c41ed6a21acb8c8aa80af8657d29
|
4
|
+
data.tar.gz: 2706932b984d4ea3e1a4db88dd45e6329cf705928e8d7b120e8e93b611ca0683
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86b20eefe439bfbe193ebb83bbade1c930c156e86b107cf73daf97f4894d33f4ea4c693090fabe04476c1a1159f1d169c1e1ef9e24635d75087ea59ebaa37e40
|
7
|
+
data.tar.gz: 0d459adab69a098925553c5e5b017e126ae0756ef126f5444ee6353f329c6f5b2fb73d4ab83b198904c6392c93b7604749b2e3ea3dc1e24e62f5e7b688161cee
|
data/.codeclimate.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
### [0.1.3](https://github.com/hschne/mr-loga-loga/compare/v0.1.2...v0.1.3) (2022-01-14)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* json formatter errors ([874f3dd](https://github.com/hschne/mr-loga-loga/commit/874f3dd480e05792712495eb6b7c77c35474adc1))
|
9
|
+
|
3
10
|
### [0.1.2](https://github.com/hschne/mr-loga-loga/compare/v0.1.1...v0.1.2) (2022-01-05)
|
4
11
|
|
5
12
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -9,6 +9,9 @@
|
|
9
9
|
[](https://badge.fury.io/rb/mr_loga_loga)
|
10
10
|
[](https://github.com/hschne/mr-loga-loga/actions/workflows/main.yml)
|
11
11
|

|
12
|
+
|
13
|
+
[](https://codeclimate.com/github/hschne/mr-loga-loga/maintainability)
|
14
|
+
[](https://codeclimate.com/github/hschne/mr-loga-loga/test_coverage)
|
12
15
|
</div>
|
13
16
|
|
14
17
|
## What's this?
|
@@ -21,7 +24,7 @@ logger.info('message', user: 'name', data: 1)
|
|
21
24
|
# I, [2022-01-01T12:00:00.000000 #19074] INFO -- Main: message user=user data=1
|
22
25
|
```
|
23
26
|
|
24
|
-
You can find out more about the motivation behind the project [here](#why-mrlogaloga). For usage read [Usage](#usage) or [Advanced Usage](#advanced-usage)
|
27
|
+
You can find out more about the motivation behind the project [here](#why-mrlogaloga). For usage read [Usage](#usage) or [Advanced Usage](#advanced-usage).
|
25
28
|
|
26
29
|
**Note**: This gem is in early development. Try it out and leave some feedback, it really goes a long way in helping me out with development. Any [feature request](https://github.com/hschne/mr-loga-loga/issues/new?assignees=&labels=type%3ABug&template=FEATURE_REQUEST.md&title=) or [bug report](https://github.com/hschne/mr-loga-loga/issues/new?assignees=&labels=type%3AEnhancement&template=BUG_REPORT.md&title=) is welcome. If you like this project, leave a star to show your support! ⭐
|
27
30
|
|
@@ -126,7 +129,7 @@ You can implement and add your own formatters like so:
|
|
126
129
|
|
127
130
|
```ruby
|
128
131
|
class MyFormatter
|
129
|
-
def call(severity, datetime, progname, message, context)
|
132
|
+
def call(severity, datetime, progname, message, **context)
|
130
133
|
context = context.map { |key, value| "#{key}=#{value}" }.compact.join(' ')
|
131
134
|
"#{severity} #{datetime.strftime('%Y-%m-%dT%H:%M:%S.%6N')} #{progname} #{message} #{context}"
|
132
135
|
end
|
@@ -186,7 +189,7 @@ Thank you for contributing! :heart:
|
|
186
189
|
|
187
190
|
We welcome all support, whether on bug reports, code, design, reviews, tests, documentation, translations, or just feature requests.
|
188
191
|
|
189
|
-
Please use [GitHub issues](https://github.com/hschne/
|
192
|
+
Please use [GitHub issues](https://github.com/hschne/mr-loga-loga/issues) to submit bugs or feature requests.
|
190
193
|
|
191
194
|
## License
|
192
195
|
|
@@ -20,19 +20,19 @@ module MrLogaLoga
|
|
20
20
|
# @param severity [String] The message severity
|
21
21
|
# @param datetime [DateTime] The message date time
|
22
22
|
# @param progname [DateTime] The program name
|
23
|
-
# @param message [
|
23
|
+
# @param message [Object] The log message, which may not be a string
|
24
24
|
# @param context [Hash] The log message context
|
25
25
|
#
|
26
26
|
# @return [String] the formatted log message
|
27
27
|
def call(severity, datetime, progname, message, **context)
|
28
|
-
message = message.nil?
|
28
|
+
message = message.nil? ? '' : msg2str(message)
|
29
29
|
|
30
30
|
message_hash = {
|
31
31
|
severity: severity,
|
32
32
|
datetime: datetime.strftime('%Y-%m-%dT%H:%M:%S.%6N'),
|
33
33
|
pid: Process.pid,
|
34
34
|
progname: progname,
|
35
|
-
message: message,
|
35
|
+
message: (message.empty? ? nil : message),
|
36
36
|
**context
|
37
37
|
}.compact
|
38
38
|
"#{message_hash.to_json}\n"
|
@@ -11,6 +11,7 @@ module MrLogaLoga
|
|
11
11
|
{ class_name: self.class.name }
|
12
12
|
end
|
13
13
|
|
14
|
+
# A shorthand method to use in your classes
|
14
15
|
def logger
|
15
16
|
if loga_loga.is_a?(MrLogaLoga::Logger)
|
16
17
|
MrLogaLoga::LoggerProxy.new(loga_loga, -> { loga_context })
|
@@ -19,6 +20,7 @@ module MrLogaLoga
|
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
23
|
+
# Define the underlying logger to be used. Overwrite this to use a specific logger instance
|
22
24
|
def loga_loga
|
23
25
|
@loga_loga ||= if defined?(Rails.logger)
|
24
26
|
Rails.logger
|
data/lib/mr_loga_loga/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mr_loga_loga
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hschne
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -73,6 +73,7 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- ".codeclimate.yml"
|
76
77
|
- ".github/ISSUE_TEMPLATE/BUG_REPORT.md"
|
77
78
|
- ".github/ISSUE_TEMPLATE/FEATURE_REQUEST.md"
|
78
79
|
- ".github/ISSUE_TEMPLATE/config.yml"
|