lumberjack_data_dog 1.0.1 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1033352bd0532183f9ca57cc3ce6c6543755dbb76cae5efa1259573e42c95ae4
4
- data.tar.gz: cd54d5db4c1d8599e2980331e7c6f8e9885872747d409ca8b833504ef1152536
3
+ metadata.gz: 53517e1a4626e2ca86c9a78968008ce667612cb8121ad769a82484056ab7d23c
4
+ data.tar.gz: 3ad569bd2691572c29fbb14dfd569cde90ad8c38bd36dda3f0c720ce33b19e88
5
5
  SHA512:
6
- metadata.gz: e654fe142fbf46f7565a9007049fcc897ba43d741f9759c725c3862398b2e32e2636f2ea6dfc37de04f6507f93b379353cef3fe3563df3b7a5d9d872479a2376
7
- data.tar.gz: ec7d80339a8cadefa306e7074ed1e8eaf9261fcb39a08f37355268706d2ae500c46c2bff57afdd560d6416d7f28683bce779db439b68250bd765c46f1bc6c90f
6
+ metadata.gz: b52261c574346d6dad7fc25a2d898c7ae6280a8b8487aeb4341df43ba5d1c5e6a3cb692582dc3d97d7222ab386765fc9c49147adeb1145338a8abbec3e999b22
7
+ data.tar.gz: 829c023744c9bc34c1c96f02fe1facde15ccd2eaab80f0e29712679d252bfcccec4d154a9dd54d5c599532fe8c8c8dbc4cd0b6dff0458569b5951e6f07a0a761
@@ -3,10 +3,8 @@ name: Continuous Integration
3
3
  on:
4
4
  push:
5
5
  branches:
6
- - master
6
+ - main
7
7
  - actions-*
8
- tags:
9
- - v*
10
8
  pull_request:
11
9
  branches-ignore:
12
10
  - actions-*
@@ -29,9 +27,8 @@ jobs:
29
27
  standardrb: true
30
28
  - ruby: "3.0"
31
29
  - ruby: "2.7"
32
- - ruby: "2.5"
33
30
  steps:
34
- - uses: actions/checkout@v2
31
+ - uses: actions/checkout@v4
35
32
  - name: Set up Ruby
36
33
  uses: ruby/setup-ruby@v1
37
34
  with:
data/.standard.yml CHANGED
@@ -1,4 +1,4 @@
1
- ruby_version: 2.5
1
+ ruby_version: 2.7
2
2
 
3
3
  format: progress
4
4
 
data/CHANGE_LOG.md CHANGED
@@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 1.1.0
8
+
9
+ ### Added
10
+
11
+ - Support for Lumberjack 2.0.
12
+
13
+ ### Changed
14
+
15
+ - This is the last release for the gem under the `lumberjack_data_dog` name. Future updates are being released under the name `lumberjack_datadog`.
16
+
17
+ ### Removed
18
+
19
+ - Support for Ruby < 2.7
20
+
7
21
  ## 1.0.1
8
22
 
9
23
  ### Added
data/README.md CHANGED
@@ -4,6 +4,9 @@
4
4
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
5
5
  [![Gem Version](https://badge.fury.io/rb/lumberjack_data_dog.svg)](https://badge.fury.io/rb/lumberjack_data_dog)
6
6
 
7
+ > [!IMPORTANT]
8
+ > This gem has been renamed to [`lumberjack_datadog`](https://github.com/bdurand/lumberjack_datadog). For new versions switch using that gem.
9
+
7
10
  This gem provides a logging setup for using the [lumberjack](https://github.com/bdurand/lumberjack) gem with DataDog. It sets up JSON logging and maps values to DataDog's [standard attributes](https://docs.datadoghq.com/logs/processing/attributes_naming_convention/).
8
11
 
9
12
  ## Features
@@ -17,7 +20,7 @@ This gem provides a logging setup for using the [lumberjack](https://github.com/
17
20
  - **Duration Logging**: Automatic conversion of duration values to nanoseconds for DataDog
18
21
  - **Configurable Message Truncation**: Limit message length to prevent oversized logs
19
22
  - **Thread Information**: Optional thread name logging
20
- - **Tag Remapping**: Flexible tag transformation and remapping
23
+ - **attribute Remapping**: Flexible attribute transformation and remapping
21
24
  - **Pretty JSON**: Optional pretty-printed JSON output for development
22
25
 
23
26
  ## Usage
@@ -51,8 +54,8 @@ logger = Lumberjack::DataDog.setup(log_device, level: :info) do |config|
51
54
  # Disable PID logging
52
55
  config.pid = false
53
56
 
54
- # Remap custom tags to DataDog attributes
55
- config.remap_tags(
57
+ # Remap custom attributes to DataDog attributes
58
+ config.remap_attributes(
56
59
  user_id: "usr.id",
57
60
  request_id: "http.request_id"
58
61
  )
@@ -70,10 +73,8 @@ end
70
73
 
71
74
  ```ruby
72
75
  # Log to a file instead of STDOUT
73
- File.open("/var/log/app.log", "a") do |file|
74
- logger = Lumberjack::DataDog.setup(file)
75
- logger.info("Logged to file")
76
- end
76
+ logger = Lumberjack::DataDog.setup("/var/log/app.log")
77
+ logger.info("Logged to file")
77
78
  ```
78
79
 
79
80
  ### Exception Logging
@@ -108,11 +109,11 @@ logger.info("API call", duration_micros: 1500) # microseconds
108
109
  logger.info("Function", duration_ns: 1500000) # nanoseconds
109
110
  ```
110
111
 
111
- ### Custom Tag Transformation
112
+ ### Custom attribute Transformation
112
113
 
113
114
  ```ruby
114
115
  logger = Lumberjack::DataDog.setup do |config|
115
- config.remap_tags(
116
+ config.remap_attributes(
116
117
  # Simple remapping
117
118
  correlation_id: "trace.correlation_id",
118
119
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.1.0
@@ -15,8 +15,8 @@ module Lumberjack::DataDog
15
15
  attr_accessor :backtrace_cleaner
16
16
  attr_accessor :thread_name
17
17
  attr_accessor :pid
18
- attr_accessor :allow_all_tags
19
- attr_reader :tag_mapping
18
+ attr_accessor :allow_all_attributes
19
+ attr_reader :attribute_mapping
20
20
  attr_accessor :pretty
21
21
 
22
22
  def initialize
@@ -24,13 +24,13 @@ module Lumberjack::DataDog
24
24
  @backtrace_cleaner = nil
25
25
  @thread_name = false
26
26
  @pid = true
27
- @allow_all_tags = true
28
- @tag_mapping = {}
27
+ @allow_all_attributes = true
28
+ @attribute_mapping = {}
29
29
  @pretty = false
30
30
  end
31
31
 
32
- def remap_tags(tag_mapping)
33
- @tag_mapping = @tag_mapping.merge(tag_mapping)
32
+ def remap_attributes(attribute_mapping)
33
+ @attribute_mapping = @attribute_mapping.merge(attribute_mapping)
34
34
  end
35
35
 
36
36
  def validate!
@@ -56,40 +56,40 @@ module Lumberjack::DataDog
56
56
  private
57
57
 
58
58
  def new_logger(stream, options, config)
59
- logger = Lumberjack::Logger.new(json_device(stream, config), options)
59
+ logger = Lumberjack::Logger.new(json_device(stream, config), **options)
60
60
 
61
- # Add the error to the error tag if an exception is logged as the message.
61
+ # Add the error to the error attribute if an exception is logged as the message.
62
62
  logger.message_formatter.add(Exception, message_exception_formatter)
63
63
 
64
- # Split the error tag up into standard attributes if it is an exception.
65
- logger.tag_formatter.add(Exception, exception_tag_formatter(config))
64
+ # Split the error attribute up into standard attributes if it is an exception.
65
+ logger.attribute_formatter.add(Exception, exception_attribute_formatter(config))
66
66
 
67
67
  if config.thread_name
68
68
  if config.thread_name == :global
69
- logger.tag_globally("logger.thread_name" => -> { Lumberjack::Utils.global_thread_id })
69
+ logger.tag!("logger.thread_name" => -> { Lumberjack::Utils.global_thread_id })
70
70
  else
71
- logger.tag_globally("logger.thread_name" => -> { Lumberjack::Utils.thread_name })
71
+ logger.tag!("logger.thread_name" => -> { Lumberjack::Utils.thread_name })
72
72
  end
73
73
  end
74
74
 
75
75
  if config.pid == :global
76
- logger.tag_globally("pid" => -> { Lumberjack::Utils.global_pid })
76
+ logger.tag!("pid" => -> { Lumberjack::Utils.global_pid })
77
77
  end
78
78
 
79
79
  logger
80
80
  end
81
81
 
82
82
  def json_device(stream, config)
83
- Lumberjack::JsonDevice.new(stream, mapping: json_mapping(config), pretty: config.pretty)
83
+ Lumberjack::JsonDevice.new(output: stream, mapping: json_mapping(config), pretty: config.pretty)
84
84
  end
85
85
 
86
86
  def json_mapping(config)
87
- mapping = config.tag_mapping.transform_keys(&:to_sym)
87
+ mapping = config.attribute_mapping.transform_keys(&:to_sym)
88
88
  mapping = mapping.merge(STANDARD_ATTRIBUTE_MAPPING)
89
89
 
90
90
  mapping.delete(:pid) if !config.pid || config.pid == :global
91
91
 
92
- mapping[:tags] = "*" if config.allow_all_tags
92
+ mapping[:attributes] = "*" if config.allow_all_attributes
93
93
 
94
94
  mapping[:message] = if config.max_message_length
95
95
  truncate_message_transformer(config.max_message_length)
@@ -129,15 +129,15 @@ module Lumberjack::DataDog
129
129
  end
130
130
  end
131
131
 
132
- def exception_tag_formatter(config)
132
+ def exception_attribute_formatter(config)
133
133
  lambda do |error|
134
- error_tags = {"kind" => error.class.name, "message" => error.message}
134
+ error_attributes = {"kind" => error.class.name, "message" => error.message}
135
135
  trace = error.backtrace
136
136
  if trace
137
137
  trace = config.backtrace_cleaner.clean(trace) if config.backtrace_cleaner
138
- error_tags["stack"] = trace
138
+ error_attributes["stack"] = trace
139
139
  end
140
- error_tags
140
+ error_attributes
141
141
  end
142
142
  end
143
143
  end
@@ -8,6 +8,12 @@ Gem::Specification.new do |spec|
8
8
  spec.homepage = "https://github.com/bdurand/lumberjack_data_dog"
9
9
  spec.license = "MIT"
10
10
 
11
+ spec.metadata = {
12
+ "homepage_uri" => spec.homepage,
13
+ "source_code_uri" => spec.homepage,
14
+ "changelog_uri" => "#{spec.homepage}/blob/main/CHANGE_LOG.md"
15
+ }
16
+
11
17
  # Specify which files should be added to the gem when it is released.
12
18
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
13
19
  ignore_files = %w[
@@ -26,7 +32,7 @@ Gem::Specification.new do |spec|
26
32
 
27
33
  spec.require_paths = ["lib"]
28
34
 
29
- spec.required_ruby_version = ">= 2.5"
35
+ spec.required_ruby_version = ">= 2.7"
30
36
 
31
- spec.add_dependency "lumberjack_json_device", ">= 2.0.0"
37
+ spec.add_dependency "lumberjack_json_device", ">= 3.0.0"
32
38
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lumberjack_data_dog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Durand
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-07-19 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: lumberjack_json_device
@@ -16,15 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: 2.0.0
18
+ version: 3.0.0
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: 2.0.0
27
- description:
25
+ version: 3.0.0
28
26
  email:
29
27
  - bbdurand@gmail.com
30
28
  executables: []
@@ -44,8 +42,10 @@ files:
44
42
  homepage: https://github.com/bdurand/lumberjack_data_dog
45
43
  licenses:
46
44
  - MIT
47
- metadata: {}
48
- post_install_message:
45
+ metadata:
46
+ homepage_uri: https://github.com/bdurand/lumberjack_data_dog
47
+ source_code_uri: https://github.com/bdurand/lumberjack_data_dog
48
+ changelog_uri: https://github.com/bdurand/lumberjack_data_dog/blob/main/CHANGE_LOG.md
49
49
  rdoc_options: []
50
50
  require_paths:
51
51
  - lib
@@ -53,15 +53,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: '2.5'
56
+ version: '2.7'
57
57
  required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  requirements: []
63
- rubygems_version: 3.4.10
64
- signing_key:
63
+ rubygems_version: 3.6.9
65
64
  specification_version: 4
66
65
  summary: Lumberjack logging device that outputs JSON formatted for DataDog with standard
67
66
  attribute mapping.