lumberjack_syslog_device 2.0.0 → 2.0.1

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: 54c251e482e25bc736ad9947d10faee5afe7ea0df526df3ba7aaf80cb2487258
4
- data.tar.gz: 1a190f22ebeb58d6b93388184b01270c8348f00444e3d94b122239c89791c9da
3
+ metadata.gz: ae9edfa3889248b54ab6ab7daca3d417a6879a1a16bd15cda77b9f913f19d418
4
+ data.tar.gz: c416513472887a7b4a34ff6194d84db8620a485298f0cd03e542d2270a26448c
5
5
  SHA512:
6
- metadata.gz: 0d0091c9a2887b37f471fe65ce665fca5047d399c116ccf29305d401b1888c9094cd0c09bc98f4682043241aed7df2da0b1434b3d8e7959453bcb503b4a23ef0
7
- data.tar.gz: 8dcb7a000c0c391fe1d92a07e7e0bf021fdd3120ddccdde277f5a33ff902bdb86f38a895b6437001ce61d039a9a42a8a7cbc772a86c53e58d7a7600a9b400a6f
6
+ metadata.gz: 6c6d7ad6cb82f45738370573a8d215a658296848b54f87e663819b20178ab6363872fc4aaac6edd9786238bfe1930721351969d89e9ce09e9f7b233585518242
7
+ data.tar.gz: d31ba78fa6219ebeffd579c6edeb54d119e3d24c6df85c0a86930d9e9652d966ebea4c6566ab8878df1d0cb2b9567fec03e7f79ca6c1d57dc2a2cb62185d4554
@@ -1,4 +1,3 @@
1
- # Dependabot update strategy
2
1
  version: 2
3
2
  updates:
4
3
  - package-ecosystem: bundler
@@ -6,7 +5,10 @@ updates:
6
5
  schedule:
7
6
  interval: weekly
8
7
  allow:
9
- # Automatically keep all runtime dependencies updated
10
8
  - dependency-name: "*"
11
9
  dependency-type: "production"
12
- versioning-strategy: lockfile-only
10
+ versioning-strategy: increase-if-necessary
11
+ - package-ecosystem: github-actions
12
+ directory: "/"
13
+ schedule:
14
+ interval: weekly
@@ -10,12 +10,6 @@ on:
10
10
  - actions-*
11
11
  workflow_dispatch:
12
12
 
13
- env:
14
- BUNDLE_CLEAN: "true"
15
- BUNDLE_PATH: vendor/bundle
16
- BUNDLE_JOBS: 3
17
- BUNDLE_RETRY: 3
18
-
19
13
  jobs:
20
14
  build:
21
15
  name: ${{ matrix.ruby }} build
@@ -29,19 +23,16 @@ jobs:
29
23
  - ruby: "3.0"
30
24
  - ruby: "2.7"
31
25
  steps:
32
- - uses: actions/checkout@v4
33
- - name: Set up Ruby
34
- uses: ruby/setup-ruby@v1
35
- with:
36
- ruby-version: ${{ matrix.ruby}}
37
- - name: Install gems
38
- run: |
39
- bundle install
40
- - name: Run Tests
41
- run: bundle exec rake
42
- - name: standardrb
43
- if: matrix.standardrb
44
- run: bundle exec standardrb
45
- - name: yard
46
- if: matrix.yard == true
47
- run: bundle exec yard --fail-on-warning
26
+ - name: Checkout
27
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
28
+ with:
29
+ persist-credentials: false
30
+ - name: Ruby CI
31
+ uses: bdurand/github-actions/ruby-ci@b7560883d5f8557f5d69fe8bd82721bbb5ed76df # v1.0.4
32
+ with:
33
+ ruby: ${{ matrix.ruby }}
34
+ appraisal: ${{ matrix.appraisal }}
35
+ bundler: ${{ matrix.bundler }}
36
+ standardrb: ${{ matrix.standardrb }}
37
+ yard: ${{ matrix.yard }}
38
+ frozen_strings: ${{ matrix.frozen_strings }}
data/.standard.yml CHANGED
@@ -1,10 +1,3 @@
1
- # I really just have issues with the automatic "semantic blocks"
2
-
3
1
  ruby_version: 2.7
4
2
 
5
3
  format: progress
6
-
7
- ignore:
8
- - 'spec/**/*':
9
- - Lint/UselessAssignment
10
- - Lint/Void
@@ -4,6 +4,16 @@ 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
+ ## 2.0.1
8
+
9
+ ### Fixed
10
+
11
+ - Fixed `close` raising a `NoMethodError` due to referencing an unset lock and connection.
12
+ - Fixed the syslog connection being closed and reopened on every write when using the default facility. The facility now defaults to `Syslog::LOG_USER` so the connection reuse check matches what syslog reports.
13
+ - A nil progname now opens syslog with a nil ident so syslog defaults to the program name instead of an empty string.
14
+ - Unmapped severity values are now logged as `Syslog::LOG_ALERT` instead of raising a `TypeError`.
15
+ - The log mask is now reset when reusing a connection opened elsewhere with a more restrictive mask.
16
+
7
17
  ## 2.0.0
8
18
 
9
19
  ### Added
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.0.1
@@ -79,9 +79,10 @@ module Lumberjack
79
79
  @template = Template.new(@template, attribute_format: attribute_format) if @template.is_a?(String)
80
80
 
81
81
  @syslog_options = options[:options] || (Syslog::LOG_PID | Syslog::LOG_CONS)
82
- @syslog_facility = options[:facility]
82
+ # Syslog substitutes LOG_USER for a nil facility; normalize here so the
83
+ # connection reuse check in open_syslog matches what syslog reports back.
84
+ @syslog_facility = options[:facility] || Syslog::LOG_USER
83
85
  @close_connection = options[:close_connection]
84
- @syslog_identity = nil
85
86
  end
86
87
 
87
88
  # Write a log entry to syslog.
@@ -90,10 +91,11 @@ module Lumberjack
90
91
  # @return [void]
91
92
  def write(entry)
92
93
  message = @template.call(entry).to_s.chomp.gsub(PERCENT, ESCAPED_PERCENT)
94
+ severity = SEVERITY_MAP[entry.severity] || Syslog::LOG_ALERT
93
95
  @@lock.synchronize do
94
96
  syslog = open_syslog(entry.progname)
95
97
  begin
96
- syslog.log(SEVERITY_MAP[entry.severity], message)
98
+ syslog.log(severity, message)
97
99
  ensure
98
100
  syslog.close if @close_connection
99
101
  end
@@ -105,8 +107,8 @@ module Lumberjack
105
107
  # @return [void]
106
108
  def close
107
109
  flush
108
- @lock.synchronize do
109
- @syslog.close if @syslog&.opened?
110
+ @@lock.synchronize do
111
+ syslog_implementation.close if syslog_implementation.opened?
110
112
  end
111
113
  end
112
114
 
@@ -118,12 +120,15 @@ module Lumberjack
118
120
  syslog_impl = syslog_implementation
119
121
  if syslog_impl.opened?
120
122
  if (progname.nil? || syslog_impl.ident == progname.to_s) && @syslog_facility == syslog_impl.facility && @syslog_options == syslog_impl.options
123
+ syslog_impl.mask = Syslog::LOG_UPTO(Syslog::LOG_DEBUG)
121
124
  return syslog_impl
122
125
  else
123
126
  syslog_impl.close
124
127
  end
125
128
  end
126
- syslog = syslog_impl.open(progname.to_s, @syslog_options, @syslog_facility)
129
+ # Pass nil rather than an empty string when there is no progname so that
130
+ # syslog falls back to the program name for the ident.
131
+ syslog = syslog_impl.open(progname&.to_s, @syslog_options, @syslog_facility)
127
132
  syslog.mask = Syslog::LOG_UPTO(Syslog::LOG_DEBUG)
128
133
  syslog
129
134
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.metadata = {
12
12
  "homepage_uri" => spec.homepage,
13
13
  "source_code_uri" => spec.homepage,
14
- "changelog_uri" => "#{spec.homepage}/blob/main/CHANGE_LOG.md"
14
+ "changelog_uri" => "#{spec.homepage}/blob/main/CHANGELOG.md"
15
15
  }
16
16
 
17
17
  # Specify which files should be added to the gem when it is released.
@@ -36,6 +36,4 @@ Gem::Specification.new do |spec|
36
36
 
37
37
  spec.add_dependency "lumberjack", ">=2.0"
38
38
  spec.add_dependency "syslog"
39
-
40
- spec.add_development_dependency "bundler"
41
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lumberjack_syslog_device
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Durand
@@ -37,20 +37,6 @@ dependencies:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
- - !ruby/object:Gem::Dependency
41
- name: bundler
42
- requirement: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: '0'
47
- type: :development
48
- prerelease: false
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
40
  email:
55
41
  - bbdurand@gmail.com
56
42
  executables: []
@@ -60,7 +46,7 @@ files:
60
46
  - ".github/dependabot.yml"
61
47
  - ".github/workflows/continuous_integration.yml"
62
48
  - ".standard.yml"
63
- - CHANGE_LOG.md
49
+ - CHANGELOG.md
64
50
  - MIT_LICENSE.txt
65
51
  - README.md
66
52
  - VERSION
@@ -73,7 +59,7 @@ licenses:
73
59
  metadata:
74
60
  homepage_uri: https://github.com/bdurand/lumberjack_syslog_device
75
61
  source_code_uri: https://github.com/bdurand/lumberjack_syslog_device
76
- changelog_uri: https://github.com/bdurand/lumberjack_syslog_device/blob/main/CHANGE_LOG.md
62
+ changelog_uri: https://github.com/bdurand/lumberjack_syslog_device/blob/main/CHANGELOG.md
77
63
  rdoc_options: []
78
64
  require_paths:
79
65
  - lib
@@ -88,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
74
  - !ruby/object:Gem::Version
89
75
  version: '0'
90
76
  requirements: []
91
- rubygems_version: 3.6.9
77
+ rubygems_version: 4.0.3
92
78
  specification_version: 4
93
79
  summary: A logging device for the lumberjack gem that writes log entries to syslog.
94
80
  test_files: []