logrb 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b5d74be8b8ba51716b2ac26aa49012a07cb7a89f294ed9d94603ecf1c5b1e66
4
- data.tar.gz: 12ddcbf56cfdb6fd89c5476e04914be8aa5bb6dc3061a44cf7abbc3ff4fee454
3
+ metadata.gz: d027adffc6c4761f66e8174524138ee2bab9a3ce58fe074ad15aa5fb368412a3
4
+ data.tar.gz: a7d28fa3c258500516a322b4bcf51eb263d08c6f0e27cff14e382b0d364627a2
5
5
  SHA512:
6
- metadata.gz: a7f6030eb6a5fd71803f7076820751f1e6bb63b4e4669fae1d0aa0f235f8200e9468784abced5818e30f061cc04c9e9ccc251e7d7ae9e9691605020017b2df87
7
- data.tar.gz: 21ee4e2c74e70fb53591ce7d1ad73c1f335a6d3b4d4e2c2c9537ef49b4bf1c7c9e82743cee1b85ec025d39e5c1936d38f59736264a6c63b14d95caef3b4cf02e
6
+ metadata.gz: f5b1434eb279c7f0ce562128b2ff93e5003cfee4d9f01e89d2ddbbf0792877ce89c03185b499a1b9c73e9437446a8b29cfacf935e1ab58f0673a1bd40d490054
7
+ data.tar.gz: 38aaad9cd6eb511a2dce961f20d4085e4158dcfa8bff591dc1924cd70382a21e0540c0c5db27cc9073b0e2f859dcff4bada0f0fa0171ce05d731f03b80dd4699
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- logrb (0.1.2)
4
+ logrb (0.1.5)
5
5
  hexdump (~> 0.3.0)
6
6
 
7
7
  GEM
@@ -45,6 +45,7 @@ GEM
45
45
  unicode-display_width (2.0.0)
46
46
 
47
47
  PLATFORMS
48
+ arm64-darwin-23
48
49
  x86_64-darwin-20
49
50
  x86_64-linux
50
51
 
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021 Victor Gama
3
+ Copyright (c) 2021-2024 Vito Sartori
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/lib/logrb/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Logrb
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.5"
5
5
  end
data/lib/logrb.rb CHANGED
@@ -25,8 +25,11 @@ require "json"
25
25
  # current process to exit with a status 1.
26
26
  #
27
27
  # #warn(msg, **fields): Outputs a warning entry.
28
+ #
28
29
  # #info(msg, **fields): Outputs a informational entry.
30
+ #
29
31
  # #debug(msg, **fields): Outputs a debug entry.
32
+ #
30
33
  # #dump(msg, data=nil): Outputs a given String or Array of bytes using the
31
34
  # same format as `hexdump -C`.
32
35
  class Logrb
@@ -169,9 +172,9 @@ class Logrb
169
172
 
170
173
  # Internal: Performs a cleanup for a given backtrace frame.
171
174
  #
172
- # trace - Trace to be clean.
175
+ # trace - Trace to be clean.
173
176
  # include_function_name - Optional. When true, includes the function name
174
- # on the normalized string. Defaults to false.
177
+ # on the normalized string. Defaults to false.
175
178
  def normalize_location(trace, include_function_name: false)
176
179
  path = trace.absolute_path
177
180
  return trace.to_s if path.nil?
@@ -189,6 +192,7 @@ class Logrb
189
192
  end
190
193
 
191
194
  # Internal: Composes a log line with given information.
195
+ #
192
196
  # level - The severity of the log message
193
197
  # caller_meta - An Array containing the caller's location and name
194
198
  # msg - The message to be logged
@@ -206,6 +210,7 @@ class Logrb
206
210
  end
207
211
 
208
212
  # Internal: Logs a text entry to the current output.
213
+ #
209
214
  # level - The severity of the message to be logged.
210
215
  # msg - The message to be logged
211
216
  # error - Either an Exception object or nil. This parameter is used
@@ -218,6 +223,7 @@ class Logrb
218
223
  fields.merge! @fields
219
224
  write_output(compose_line(level, caller_meta, msg, fields))
220
225
  if (error_message = error&.message)
226
+ write_output(": #{error.class.name}")
221
227
  write_output(": #{error_message}")
222
228
  end
223
229
  write_output("\n")
@@ -250,6 +256,7 @@ class Logrb
250
256
  end
251
257
 
252
258
  # Internal: Logs a JSON entry to the current output.
259
+ #
253
260
  # level - The severity of the message to be logged.
254
261
  # msg - The message to be logged
255
262
  # error - Either an Exception object or nil. This parameter is used
@@ -267,7 +274,11 @@ class Logrb
267
274
  ts: Time.now.utc.to_i
268
275
  }
269
276
 
270
- data[:stacktrace] = backtrace(error) if level == :error
277
+ if level == :error
278
+ data[:exception_class] = error.class.to_s
279
+ data[:exception] = error.message if error.respond_to?(:message)
280
+ data[:stacktrace] = backtrace(error)
281
+ end
271
282
 
272
283
  data.merge!(fields)
273
284
  write_output("#{data.to_json}\n")
data/logrb.gemspec CHANGED
@@ -5,7 +5,7 @@ require_relative "lib/logrb/version"
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "logrb"
7
7
  spec.version = Logrb::VERSION
8
- spec.authors = ["Victor Gama"]
8
+ spec.authors = ["Vito Sartori"]
9
9
  spec.email = ["hey@vito.io"]
10
10
 
11
11
  spec.summary = "Small logger inspired by Go's Zap"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
- - Victor Gama
7
+ - Vito Sartori
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-17 00:00:00.000000000 Z
11
+ date: 2024-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hexdump
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  requirements: []
71
- rubygems_version: 3.2.22
71
+ rubygems_version: 3.4.10
72
72
  signing_key:
73
73
  specification_version: 4
74
74
  summary: Small logger inspired by Go's Zap