mr_loga_loga 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9302fc69d4d56866600c8d8fb20eedf503dd21d4749b4bc737614ecc73f4569a
4
- data.tar.gz: 9e064b34de99a0fa1e624d2969cae8bfa2f1e425f1e53781243bf8c54c314c1a
3
+ metadata.gz: f131fea9745ad602c462f8b79aedd2a6e921c41ed6a21acb8c8aa80af8657d29
4
+ data.tar.gz: 2706932b984d4ea3e1a4db88dd45e6329cf705928e8d7b120e8e93b611ca0683
5
5
  SHA512:
6
- metadata.gz: cd158e43d67fc8988387b247199768ba72b0e349860ad065b30c29b8a17a400dd7023b3587c8bd350f453818c489110d00975fbfe07da13dc07af76795bc4800
7
- data.tar.gz: ce8770ac8a506652642ac564ed585be8b3b8f935b20afb1cd2162d732b44b09cc79d346aaca7d23858f4b3033861d19aff3259e31e16fc653960f5501ff421ff
6
+ metadata.gz: 86b20eefe439bfbe193ebb83bbade1c930c156e86b107cf73daf97f4894d33f4ea4c693090fabe04476c1a1159f1d169c1e1ef9e24635d75087ea59ebaa37e40
7
+ data.tar.gz: 0d459adab69a098925553c5e5b017e126ae0756ef126f5444ee6353f329c6f5b2fb73d4ab83b198904c6392c93b7604749b2e3ea3dc1e24e62f5e7b688161cee
data/.codeclimate.yml ADDED
@@ -0,0 +1,2 @@
1
+ exclude_patterns:
2
+ - "docs/"
@@ -75,5 +75,5 @@ jobs:
75
75
  - name: Commit Updated Files 📤
76
76
  uses: EndBug/add-and-commit@v7
77
77
  with:
78
- add: "['Gemfile.lock']"
78
+ add: "['Gemfile.lock', 'lib/mr_loga_loga/version.rb']"
79
79
  message: "chore: post-release ${{ steps.release-version.outputs.version }}"
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mr_loga_loga (0.1.2)
4
+ mr_loga_loga (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -9,6 +9,9 @@
9
9
  [![Gem Version](https://badge.fury.io/rb/mr_loga_loga.svg)](https://badge.fury.io/rb/mr_loga_loga)
10
10
  [![Main](https://github.com/hschne/mr-loga-loga/actions/workflows/main.yml/badge.svg)](https://github.com/hschne/mr-loga-loga/actions/workflows/main.yml)
11
11
  ![License](https://img.shields.io/github/license/hschne/mr-loga-loga)
12
+
13
+ [![Maintainability](https://api.codeclimate.com/v1/badges/7cdd4779e6c62bce6ba0/maintainability)](https://codeclimate.com/github/hschne/mr-loga-loga/maintainability)
14
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/7cdd4779e6c62bce6ba0/test_coverage)](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/rails-mini-profiler/issues) to submit bugs or feature requests.
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 [String] The log 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? || message.empty? ? nil : msg2str(message)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MrLogaLoga
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
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.2
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-05 00:00:00.000000000 Z
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"