lumberjack_syslog_device 1.1.1 → 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 +4 -4
- data/.github/dependabot.yml +5 -3
- data/.github/workflows/continuous_integration.yml +16 -25
- data/.standard.yml +1 -8
- data/CHANGELOG.md +48 -0
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/lumberjack/syslog_device.rb +141 -0
- data/lib/lumberjack_syslog_device.rb +1 -126
- data/lumberjack_syslog_device.gemspec +9 -4
- metadata +15 -16
- data/.github/workflows/regression_test.yml +0 -29
- data/CHANGE_LOG.md +0 -23
- /data/{MIT_LICENSE → MIT_LICENSE.txt} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ae9edfa3889248b54ab6ab7daca3d417a6879a1a16bd15cda77b9f913f19d418
|
|
4
|
+
data.tar.gz: c416513472887a7b4a34ff6194d84db8620a485298f0cd03e542d2270a26448c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6c6d7ad6cb82f45738370573a8d215a658296848b54f87e663819b20178ab6363872fc4aaac6edd9786238bfe1930721351969d89e9ce09e9f7b233585518242
|
|
7
|
+
data.tar.gz: d31ba78fa6219ebeffd579c6edeb54d119e3d24c6df85c0a86930d9e9652d966ebea4c6566ab8878df1d0cb2b9567fec03e7f79ca6c1d57dc2a2cb62185d4554
|
data/.github/dependabot.yml
CHANGED
|
@@ -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:
|
|
10
|
+
versioning-strategy: increase-if-necessary
|
|
11
|
+
- package-ecosystem: github-actions
|
|
12
|
+
directory: "/"
|
|
13
|
+
schedule:
|
|
14
|
+
interval: weekly
|
|
@@ -3,19 +3,12 @@ name: Continuous Integration
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
|
-
-
|
|
6
|
+
- main
|
|
7
7
|
- actions-*
|
|
8
|
-
tags:
|
|
9
|
-
- v*
|
|
10
8
|
pull_request:
|
|
11
9
|
branches-ignore:
|
|
12
10
|
- actions-*
|
|
13
|
-
|
|
14
|
-
env:
|
|
15
|
-
BUNDLE_CLEAN: "true"
|
|
16
|
-
BUNDLE_PATH: vendor/bundle
|
|
17
|
-
BUNDLE_JOBS: 3
|
|
18
|
-
BUNDLE_RETRY: 3
|
|
11
|
+
workflow_dispatch:
|
|
19
12
|
|
|
20
13
|
jobs:
|
|
21
14
|
build:
|
|
@@ -26,22 +19,20 @@ jobs:
|
|
|
26
19
|
include:
|
|
27
20
|
- ruby: "ruby"
|
|
28
21
|
standardrb: true
|
|
22
|
+
yard: true
|
|
29
23
|
- ruby: "3.0"
|
|
30
24
|
- ruby: "2.7"
|
|
31
|
-
- ruby: "2.6"
|
|
32
|
-
- ruby: "2.5"
|
|
33
|
-
- ruby: "2.4"
|
|
34
25
|
steps:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
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
|
+
|
|
17
|
+
## 2.0.0
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- Lumberjack 2 support.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- Updated default template to `{{message}} {{attributes}}`. Unit of work is no longer supported in Lumberjack 2.
|
|
26
|
+
- Updated attribute formatting to use tag formatting specified in the `:tag_format` option rather than hardcoding the format.
|
|
27
|
+
|
|
28
|
+
### Removed
|
|
29
|
+
|
|
30
|
+
- Support for Ruby < 2.7.
|
|
31
|
+
|
|
32
|
+
## 1.1.1
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- Always cast values to strings before logging to syslog (thanks @eremeyev).
|
|
37
|
+
|
|
38
|
+
## 1.1.0
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- Add support for lumberjack 1.1 tags.
|
|
43
|
+
|
|
44
|
+
## 1.0.0
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
|
|
48
|
+
- Initial release.
|
data/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Lumberjack Syslog Device
|
|
2
2
|
|
|
3
3
|
[](https://github.com/bdurand/lumberjack_syslog_device/actions/workflows/continuous_integration.yml)
|
|
4
|
-
[](https://github.com/bdurand/lumberjack_syslog_device/actions/workflows/regression_test.yml)
|
|
5
4
|
[](https://github.com/testdouble/standard)
|
|
5
|
+
[](https://badge.fury.io/rb/lumberjack_syslog_device)
|
|
6
6
|
|
|
7
7
|
This gem provides a logging device for the [lumberjack](https://github.com/bdurand/lumberjack) gem that will log to syslog, the centralized system logging facility. See http://en.wikipedia.org/wiki/Syslog for more information on syslog.
|
|
8
8
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
2.0.1
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "syslog"
|
|
4
|
+
require "lumberjack"
|
|
5
|
+
|
|
6
|
+
# Lumberjack is a simple, powerful, and very fast logging utility that can be a drop
|
|
7
|
+
# in replacement for Logger or ActiveSupport::BufferedLogger.
|
|
8
|
+
module Lumberjack
|
|
9
|
+
# This Lumberjack device logs output to syslog. There can only be one connection to syslog
|
|
10
|
+
# open at a time. If you use syslog elsewhere in your application, you'll need to pass
|
|
11
|
+
# :close_connection => true to the constructor. Otherwise, the connection will be kept
|
|
12
|
+
# open between +write+ calls.
|
|
13
|
+
class SyslogDevice < Device
|
|
14
|
+
VERSION = ::File.read(::File.join(__dir__, "..", "..", "VERSION")).strip.freeze
|
|
15
|
+
|
|
16
|
+
# Mapping of Lumberjack severity levels to syslog priority levels
|
|
17
|
+
SEVERITY_MAP = {
|
|
18
|
+
Severity::TRACE => Syslog::LOG_DEBUG,
|
|
19
|
+
Severity::DEBUG => Syslog::LOG_DEBUG,
|
|
20
|
+
Severity::INFO => Syslog::LOG_INFO,
|
|
21
|
+
Severity::WARN => Syslog::LOG_WARNING,
|
|
22
|
+
Severity::ERROR => Syslog::LOG_ERR,
|
|
23
|
+
Severity::FATAL => Syslog::LOG_CRIT,
|
|
24
|
+
Severity::UNKNOWN => Syslog::LOG_ALERT
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
# Literal percent character
|
|
28
|
+
PERCENT = "%"
|
|
29
|
+
# Escaped percent character for syslog format strings
|
|
30
|
+
ESCAPED_PERCENT = "%%"
|
|
31
|
+
|
|
32
|
+
# Default template for formatting log messages
|
|
33
|
+
DEFAULT_TEMPLATE = "{{message}} {{attributes}}"
|
|
34
|
+
# Default format for rendering log entry attributes
|
|
35
|
+
DEFAULT_ATTRIBUTE_FORMAT = "[%s:%s]"
|
|
36
|
+
|
|
37
|
+
DeviceRegistry.add(:syslog, self)
|
|
38
|
+
|
|
39
|
+
@@lock = Mutex.new
|
|
40
|
+
|
|
41
|
+
# Create a new SyslogDevice. The options control how messages are written to syslog.
|
|
42
|
+
#
|
|
43
|
+
# The template can be specified using the :template option. This can
|
|
44
|
+
# either be a Proc or a string that will compile into a Template object.
|
|
45
|
+
# If the template is a Proc, it should accept an LogEntry as its only argument and output a string.
|
|
46
|
+
# If the template is a template string, it will be used to create a Template.
|
|
47
|
+
# The default template is +{{message}} {{attributes}}+.
|
|
48
|
+
#
|
|
49
|
+
# The :close_connection option can be used to specify that the connection to syslog should be
|
|
50
|
+
# closed after every +write+ call. This will slow down performance, but will allow you to use syslog
|
|
51
|
+
# elsewhere in your application.
|
|
52
|
+
#
|
|
53
|
+
# The :options option will pass through options to syslog. The default is
|
|
54
|
+
# Syslog::LOG_PID | Syslog::LOG_CONS. Available values for the bit map are:
|
|
55
|
+
# * Syslog::LOG_CONS - Write directly to system console if there is an error while sending to system logger.
|
|
56
|
+
# * Syslog::LOG_NDELAY - Open the connection immediately (normally, the connection is opened when the first message is logged).
|
|
57
|
+
# * Syslog::LOG_NOWAIT - Don't wait for child processes that may have been created while logging the message.
|
|
58
|
+
# * Syslog::LOG_ODELAY - The converse of LOG_NDELAY; opening of the connection is delayed.
|
|
59
|
+
# * Syslog::LOG_PERROR - Print to stderr as well.
|
|
60
|
+
# * Syslog::LOG_PID - Include PID with each message.
|
|
61
|
+
#
|
|
62
|
+
# The :facility option will pass through a facility to syslog. Available values are
|
|
63
|
+
# * Syslog::LOG_AUTH
|
|
64
|
+
# * Syslog::LOG_AUTHPRIV
|
|
65
|
+
# * Syslog::LOG_CRON
|
|
66
|
+
# * Syslog::LOG_DAEMON
|
|
67
|
+
# * Syslog::LOG_FTP
|
|
68
|
+
# * Syslog::LOG_KERN
|
|
69
|
+
# * Syslog::LOG_LOCAL0 through Syslog::LOG_LOCAL7
|
|
70
|
+
# * Syslog::LOG_LPR
|
|
71
|
+
# * Syslog::LOG_MAIL
|
|
72
|
+
# * Syslog::LOG_NEWS
|
|
73
|
+
# * Syslog::LOG_SYSLOG
|
|
74
|
+
# * Syslog::LOG_USER (default)
|
|
75
|
+
# * Syslog::LOG_UUCP
|
|
76
|
+
def initialize(options = {})
|
|
77
|
+
@template = options[:template] || DEFAULT_TEMPLATE
|
|
78
|
+
attribute_format = options[:attribute_format] || DEFAULT_ATTRIBUTE_FORMAT
|
|
79
|
+
@template = Template.new(@template, attribute_format: attribute_format) if @template.is_a?(String)
|
|
80
|
+
|
|
81
|
+
@syslog_options = options[:options] || (Syslog::LOG_PID | Syslog::LOG_CONS)
|
|
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
|
|
85
|
+
@close_connection = options[:close_connection]
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Write a log entry to syslog.
|
|
89
|
+
#
|
|
90
|
+
# @param entry [Lumberjack::LogEntry] the log entry to write
|
|
91
|
+
# @return [void]
|
|
92
|
+
def write(entry)
|
|
93
|
+
message = @template.call(entry).to_s.chomp.gsub(PERCENT, ESCAPED_PERCENT)
|
|
94
|
+
severity = SEVERITY_MAP[entry.severity] || Syslog::LOG_ALERT
|
|
95
|
+
@@lock.synchronize do
|
|
96
|
+
syslog = open_syslog(entry.progname)
|
|
97
|
+
begin
|
|
98
|
+
syslog.log(severity, message)
|
|
99
|
+
ensure
|
|
100
|
+
syslog.close if @close_connection
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Close the syslog connection.
|
|
106
|
+
#
|
|
107
|
+
# @return [void]
|
|
108
|
+
def close
|
|
109
|
+
flush
|
|
110
|
+
@@lock.synchronize do
|
|
111
|
+
syslog_implementation.close if syslog_implementation.opened?
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
private
|
|
116
|
+
|
|
117
|
+
# Open syslog with ident set to progname. If it is already open with a different
|
|
118
|
+
# ident, close it and reopen it.
|
|
119
|
+
def open_syslog(progname) # :nodoc:
|
|
120
|
+
syslog_impl = syslog_implementation
|
|
121
|
+
if syslog_impl.opened?
|
|
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)
|
|
124
|
+
return syslog_impl
|
|
125
|
+
else
|
|
126
|
+
syslog_impl.close
|
|
127
|
+
end
|
|
128
|
+
end
|
|
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)
|
|
132
|
+
syslog.mask = Syslog::LOG_UPTO(Syslog::LOG_DEBUG)
|
|
133
|
+
syslog
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Provided for testing purposes
|
|
137
|
+
def syslog_implementation # :nodoc:
|
|
138
|
+
Syslog
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
@@ -1,128 +1,3 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
require "lumberjack"
|
|
5
|
-
|
|
6
|
-
module Lumberjack
|
|
7
|
-
# This Lumberjack device logs output to syslog. There can only be one connection to syslog
|
|
8
|
-
# open at a time. If you use syslog elsewhere in your application, you'll need to pass
|
|
9
|
-
# :close_connection => true to the constructor. Otherwise, the connection will be kept
|
|
10
|
-
# open between +write+ calls.
|
|
11
|
-
class SyslogDevice < Device
|
|
12
|
-
SEVERITY_MAP = {
|
|
13
|
-
Severity::DEBUG => Syslog::LOG_DEBUG,
|
|
14
|
-
Severity::INFO => Syslog::LOG_INFO,
|
|
15
|
-
Severity::WARN => Syslog::LOG_WARNING,
|
|
16
|
-
Severity::ERROR => Syslog::LOG_ERR,
|
|
17
|
-
Severity::FATAL => Syslog::LOG_CRIT,
|
|
18
|
-
Severity::UNKNOWN => Syslog::LOG_ALERT
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
PERCENT = "%"
|
|
22
|
-
ESCAPED_PERCENT = "%%"
|
|
23
|
-
|
|
24
|
-
@@lock = Mutex.new
|
|
25
|
-
|
|
26
|
-
# Create a new SyslogDevice. The options control how messages are written to syslog.
|
|
27
|
-
#
|
|
28
|
-
# The template can be specified using the :template option. This can
|
|
29
|
-
# either be a Proc or a string that will compile into a Template object.
|
|
30
|
-
# If the template is a Proc, it should accept an LogEntry as its only argument and output a string.
|
|
31
|
-
# If the template is a template string, it will be used to create a Template.
|
|
32
|
-
# The default template is `:message (#:unit_of_work_id) :tags`.
|
|
33
|
-
#
|
|
34
|
-
# The :close_connection option can be used to specify that the connection to syslog should be
|
|
35
|
-
# closed after every +write+ call. This will slow down performance, but will allow you to use syslog
|
|
36
|
-
# elsewhere in your application.
|
|
37
|
-
#
|
|
38
|
-
# The :options option will pass through options to syslog. The default is
|
|
39
|
-
# Syslog::LOG_PID | Syslog::LOG_CONS. Available values for the bit map are:
|
|
40
|
-
# * Syslog::LOG_CONS - Write directly to system console if there is an error while sending to system logger.
|
|
41
|
-
# * Syslog::LOG_NDELAY - Open the connection immediately (normally, the connection is opened when the first message is logged).
|
|
42
|
-
# * Syslog::LOG_NOWAIT - Don't wait for child processes that may have been created while logging the message.
|
|
43
|
-
# * Syslog::LOG_ODELAY - The converse of LOG_NDELAY; opening of the connection is delayed.
|
|
44
|
-
# * Syslog::LOG_PERROR - Print to stderr as well.
|
|
45
|
-
# * Syslog::LOG_PID - Include PID with each message.
|
|
46
|
-
#
|
|
47
|
-
# The :facility option will pass through a facility to syslog. Available values are
|
|
48
|
-
# * Syslog::LOG_AUTH
|
|
49
|
-
# * Syslog::LOG_AUTHPRIV
|
|
50
|
-
# * Syslog::LOG_CRON
|
|
51
|
-
# * Syslog::LOG_DAEMON
|
|
52
|
-
# * Syslog::LOG_FTP
|
|
53
|
-
# * Syslog::LOG_KERN
|
|
54
|
-
# * Syslog::LOG_LOCAL0 through Syslog::LOG_LOCAL7
|
|
55
|
-
# * Syslog::LOG_LPR
|
|
56
|
-
# * Syslog::LOG_MAIL
|
|
57
|
-
# * Syslog::LOG_NEWS
|
|
58
|
-
# * Syslog::LOG_SYSLOG
|
|
59
|
-
# * Syslog::LOG_USER (default)
|
|
60
|
-
# * Syslog::LOG_UUCP
|
|
61
|
-
def initialize(options = {})
|
|
62
|
-
@template = options[:template] || default_template
|
|
63
|
-
@template = Template.new(@template) if @template.is_a?(String)
|
|
64
|
-
@syslog_options = options[:options] || (Syslog::LOG_PID | Syslog::LOG_CONS)
|
|
65
|
-
@syslog_facility = options[:facility]
|
|
66
|
-
@close_connection = options[:close_connection]
|
|
67
|
-
@syslog_identity = nil
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def write(entry)
|
|
71
|
-
message = @template.call(entry).to_s.gsub(PERCENT, ESCAPED_PERCENT)
|
|
72
|
-
@@lock.synchronize do
|
|
73
|
-
syslog = open_syslog(entry.progname)
|
|
74
|
-
begin
|
|
75
|
-
syslog.log(SEVERITY_MAP[entry.severity], message)
|
|
76
|
-
ensure
|
|
77
|
-
syslog.close if @close_connection
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def close
|
|
83
|
-
flush
|
|
84
|
-
@lock.synchronize do
|
|
85
|
-
@syslog.close if @syslog&.opened?
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
private
|
|
90
|
-
|
|
91
|
-
# Open syslog with ident set to progname. If it is already open with a different
|
|
92
|
-
# ident, close it and reopen it.
|
|
93
|
-
def open_syslog(progname) # :nodoc:
|
|
94
|
-
syslog_impl = syslog_implementation
|
|
95
|
-
if syslog_impl.opened?
|
|
96
|
-
if (progname.nil? || syslog_impl.ident == progname.to_s) && @syslog_facility == syslog_impl.facility && @syslog_options == syslog_impl.options
|
|
97
|
-
return syslog_impl
|
|
98
|
-
else
|
|
99
|
-
syslog_impl.close
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
syslog = syslog_impl.open(progname.to_s, @syslog_options, @syslog_facility)
|
|
103
|
-
syslog.mask = Syslog::LOG_UPTO(Syslog::LOG_DEBUG)
|
|
104
|
-
syslog
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
# Provided for testing purposes
|
|
108
|
-
def syslog_implementation # :nodoc:
|
|
109
|
-
Syslog
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
def default_template
|
|
113
|
-
lambda do |entry|
|
|
114
|
-
tags = entry.tags
|
|
115
|
-
if tags && !tags.empty?
|
|
116
|
-
message = String.new(entry.message)
|
|
117
|
-
message << " (#{entry.unit_of_work_id})" if entry.unit_of_work_id
|
|
118
|
-
tags.each do |name, value|
|
|
119
|
-
message << " [#{name}:#{value.inspect}]" unless name == Lumberjack::LogEntry::UNIT_OF_WORK_ID
|
|
120
|
-
end
|
|
121
|
-
message
|
|
122
|
-
else
|
|
123
|
-
entry.message
|
|
124
|
-
end
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
end
|
|
3
|
+
require_relative "lumberjack/syslog_device"
|
|
@@ -8,6 +8,12 @@ Gem::Specification.new do |spec|
|
|
|
8
8
|
spec.homepage = "https://github.com/bdurand/lumberjack_syslog_device"
|
|
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/CHANGELOG.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,9 +32,8 @@ Gem::Specification.new do |spec|
|
|
|
26
32
|
|
|
27
33
|
spec.require_paths = ["lib"]
|
|
28
34
|
|
|
29
|
-
spec.required_ruby_version = ">=2.
|
|
30
|
-
|
|
31
|
-
spec.add_dependency "lumberjack", ">=1.1"
|
|
35
|
+
spec.required_ruby_version = ">=2.7"
|
|
32
36
|
|
|
33
|
-
spec.
|
|
37
|
+
spec.add_dependency "lumberjack", ">=2.0"
|
|
38
|
+
spec.add_dependency "syslog"
|
|
34
39
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lumberjack_syslog_device
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brian Durand
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: lumberjack
|
|
@@ -16,29 +15,28 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
18
|
+
version: '2.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: '
|
|
25
|
+
version: '2.0'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
27
|
+
name: syslog
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
30
|
- - ">="
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
32
|
version: '0'
|
|
34
|
-
type: :
|
|
33
|
+
type: :runtime
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
37
|
- - ">="
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
39
|
version: '0'
|
|
41
|
-
description:
|
|
42
40
|
email:
|
|
43
41
|
- bbdurand@gmail.com
|
|
44
42
|
executables: []
|
|
@@ -47,19 +45,21 @@ extra_rdoc_files: []
|
|
|
47
45
|
files:
|
|
48
46
|
- ".github/dependabot.yml"
|
|
49
47
|
- ".github/workflows/continuous_integration.yml"
|
|
50
|
-
- ".github/workflows/regression_test.yml"
|
|
51
48
|
- ".standard.yml"
|
|
52
|
-
-
|
|
53
|
-
- MIT_LICENSE
|
|
49
|
+
- CHANGELOG.md
|
|
50
|
+
- MIT_LICENSE.txt
|
|
54
51
|
- README.md
|
|
55
52
|
- VERSION
|
|
53
|
+
- lib/lumberjack/syslog_device.rb
|
|
56
54
|
- lib/lumberjack_syslog_device.rb
|
|
57
55
|
- lumberjack_syslog_device.gemspec
|
|
58
56
|
homepage: https://github.com/bdurand/lumberjack_syslog_device
|
|
59
57
|
licenses:
|
|
60
58
|
- MIT
|
|
61
|
-
metadata:
|
|
62
|
-
|
|
59
|
+
metadata:
|
|
60
|
+
homepage_uri: https://github.com/bdurand/lumberjack_syslog_device
|
|
61
|
+
source_code_uri: https://github.com/bdurand/lumberjack_syslog_device
|
|
62
|
+
changelog_uri: https://github.com/bdurand/lumberjack_syslog_device/blob/main/CHANGELOG.md
|
|
63
63
|
rdoc_options: []
|
|
64
64
|
require_paths:
|
|
65
65
|
- lib
|
|
@@ -67,15 +67,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
67
67
|
requirements:
|
|
68
68
|
- - ">="
|
|
69
69
|
- !ruby/object:Gem::Version
|
|
70
|
-
version: '2.
|
|
70
|
+
version: '2.7'
|
|
71
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
73
|
- - ">="
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
75
|
version: '0'
|
|
76
76
|
requirements: []
|
|
77
|
-
rubygems_version:
|
|
78
|
-
signing_key:
|
|
77
|
+
rubygems_version: 4.0.3
|
|
79
78
|
specification_version: 4
|
|
80
79
|
summary: A logging device for the lumberjack gem that writes log entries to syslog.
|
|
81
80
|
test_files: []
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
name: Regression Test
|
|
2
|
-
on:
|
|
3
|
-
workflow_dispatch:
|
|
4
|
-
schedule:
|
|
5
|
-
- cron: "0 15 * * 1"
|
|
6
|
-
env:
|
|
7
|
-
BUNDLE_CLEAN: "true"
|
|
8
|
-
BUNDLE_PATH: vendor/bundle
|
|
9
|
-
BUNDLE_JOBS: 3
|
|
10
|
-
BUNDLE_RETRY: 3
|
|
11
|
-
jobs:
|
|
12
|
-
specs:
|
|
13
|
-
name: Run specs
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
strategy:
|
|
16
|
-
fail-fast: false
|
|
17
|
-
steps:
|
|
18
|
-
- name: Checkout
|
|
19
|
-
uses: actions/checkout@v4
|
|
20
|
-
- name: Set up Ruby ${{ matrix.ruby }}
|
|
21
|
-
uses: ruby/setup-ruby@v1
|
|
22
|
-
with:
|
|
23
|
-
ruby-version: ruby
|
|
24
|
-
- name: Install bundler
|
|
25
|
-
run: |
|
|
26
|
-
bundle update
|
|
27
|
-
- name: Run specs
|
|
28
|
-
run: |
|
|
29
|
-
bundle exec rake spec
|
data/CHANGE_LOG.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
All notable changes to this project will be documented in this file.
|
|
3
|
-
|
|
4
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
-
|
|
7
|
-
## 1.1.1
|
|
8
|
-
|
|
9
|
-
### Changed
|
|
10
|
-
|
|
11
|
-
- Always cast values to strings before logging to syslog (thanks @eremeyev).
|
|
12
|
-
|
|
13
|
-
## 1.1.0
|
|
14
|
-
|
|
15
|
-
### Added
|
|
16
|
-
|
|
17
|
-
- Add support for lumberjack 2.0 tags.
|
|
18
|
-
|
|
19
|
-
## 1.0.0
|
|
20
|
-
|
|
21
|
-
### Added
|
|
22
|
-
|
|
23
|
-
- Initial release.
|
|
File without changes
|