semantic_logger 4.7.1 → 4.7.2

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: 53de576d3dea3ae2099d237648a027026469632dda0f8c3840557c648ddb0626
4
- data.tar.gz: a2fe41e466fd682cc536f33331698a74b19d9026cde7604db93f859e70686d25
3
+ metadata.gz: c3a735a9fbaff1f869e8beb81bf7196688a87f94bb40f8fb7861ce505f60d8a1
4
+ data.tar.gz: 0e5f6075ca9cd65fed94330affc7180c5bc638832391e967b5d7493d26f53e90
5
5
  SHA512:
6
- metadata.gz: c9c53adbda24e55a427945f9c5953c6e53c244af0c00b4f81ba59c92c3e052d9f7306fc8941bbf0960d665757c56b4089bbc1214255fdfc5ec085fdda24b601e
7
- data.tar.gz: 700143b4c0b34e347539b7b2fccd363683b45577a5520accd55a308175f92975ca041152ca03353f7e23ec71eb9189e6de54ff8f985eecf414d51b8900b2ad96
6
+ metadata.gz: 27046a2405e9662215ac6ed66d6db4a68171301c65f9c3ff06500bfedb1bf3dc2a18c2e67bbedbe705db54b26ff412623556a9f24b1b69b2a2508f54413d1951
7
+ data.tar.gz: 43db220b7e11cf718f73bcc8343c3f60f77ad63569fba509ebb1d47531055fae87c2233b2de95ed942216bb2e741f77c5ab8902ccf9686f6caf540c3a8efd27f
@@ -31,7 +31,7 @@ require "socket"
31
31
  module SemanticLogger
32
32
  module Appender
33
33
  class Syslog < SemanticLogger::Subscriber
34
- attr_reader :remote_syslog, :url, :server, :port, :protocol, :facility, :options, :level_map
34
+ attr_reader :remote_syslog, :url, :server, :port, :protocol, :facility, :options, :level_map, :max_size
35
35
 
36
36
  # Create a Syslog appender instance.
37
37
  #
@@ -73,6 +73,10 @@ module SemanticLogger
73
73
  # Identity of the program.
74
74
  # Default: SemanticLogger.application
75
75
  #
76
+ # max_size: [Integer]
77
+ # Set your own packet size.
78
+ # Default: 1024 bytes
79
+ #
76
80
  # options: [Integer]
77
81
  # Default: ::Syslog::LOG_PID | ::Syslog::LOG_CONS
78
82
  # Any of the following (options can be logically OR'd together)
@@ -121,6 +125,7 @@ module SemanticLogger
121
125
  # SemanticLogger.add_appender(appender: :syslog, level_map: {warn: ::Syslog::LOG_NOTICE})
122
126
  def initialize(url: "syslog://localhost",
123
127
  facility: ::Syslog::LOG_USER,
128
+ max_size: 1024,
124
129
  level_map: SemanticLogger::Formatters::Syslog::LevelMap.new,
125
130
  options: ::Syslog::LOG_PID | ::Syslog::LOG_CONS,
126
131
  tcp_client: {},
@@ -129,6 +134,7 @@ module SemanticLogger
129
134
 
130
135
  @options = options
131
136
  @facility = facility
137
+ @max_size = max_size
132
138
  @level_map = level_map
133
139
  @url = url
134
140
  uri = URI(@url)
@@ -209,7 +215,7 @@ module SemanticLogger
209
215
  # Format is text output without the time
210
216
  SemanticLogger::Formatters::Default.new(time_format: nil)
211
217
  else
212
- SemanticLogger::Formatters::Syslog.new(facility: facility, level_map: level_map)
218
+ SemanticLogger::Formatters::Syslog.new(facility: facility, level_map: level_map, max_size: max_size)
213
219
  end
214
220
  end
215
221
  end
@@ -7,7 +7,7 @@ end
7
7
  module SemanticLogger
8
8
  module Formatters
9
9
  class Syslog < Default
10
- attr_accessor :level_map, :facility
10
+ attr_accessor :level_map, :facility, :max_size
11
11
 
12
12
  # Default level map for every log level
13
13
  #
@@ -50,9 +50,10 @@ module SemanticLogger
50
50
  # Example:
51
51
  # # Change the warn level to LOG_NOTICE level instead of a the default of LOG_WARNING.
52
52
  # SemanticLogger.add_appender(appender: :syslog, level_map: {warn: ::Syslog::LOG_NOTICE})
53
- def initialize(facility: ::Syslog::LOG_USER, level_map: LevelMap.new)
53
+ def initialize(facility: ::Syslog::LOG_USER, level_map: LevelMap.new, max_size: Integer)
54
54
  @facility = facility
55
55
  @level_map = level_map.is_a?(LevelMap) ? level_map : LevelMap.new(level_map)
56
+ @max_size = max_size
56
57
  super()
57
58
  end
58
59
 
@@ -77,7 +78,7 @@ module SemanticLogger
77
78
  packet.content = message
78
79
  packet.time = log.time
79
80
  packet.severity = level_map[log.level]
80
- packet.to_s
81
+ packet.assemble(@max_size)
81
82
  end
82
83
  end
83
84
  end
@@ -7,7 +7,7 @@ end
7
7
  module SemanticLogger
8
8
  module Formatters
9
9
  class SyslogCee < Raw
10
- attr_accessor :level_map, :facility
10
+ attr_accessor :level_map, :facility, :max_size
11
11
 
12
12
  # CEE JSON Syslog format
13
13
  # Untested prototype code. Based on documentation only.
@@ -23,9 +23,10 @@ module SemanticLogger
23
23
  # Example:
24
24
  # # Log via udp to a remote syslog server on host: `server1` and port `8514`, using the CEE format.
25
25
  # SemanticLogger.add_appender(appender: :syslog, formatter: syslog_cee, url: 'udp://server1:8514')
26
- def initialize(facility: ::Syslog::LOG_USER, level_map: SemanticLogger::Formatters::Syslog::LevelMap.new)
26
+ def initialize(facility: ::Syslog::LOG_USER, level_map: SemanticLogger::Formatters::Syslog::LevelMap.new, max_size: Integer)
27
27
  @facility = facility
28
28
  @level_map = level_map.is_a?(SemanticLogger::Formatters::Syslog::LevelMap) ? level_map : SemanticLogger::Formatters::Syslog::LevelMap.new(level_map)
29
+ @max_size = max_size
29
30
  super()
30
31
  end
31
32
 
@@ -49,7 +50,7 @@ module SemanticLogger
49
50
  packet.content = message
50
51
  packet.time = log.time
51
52
  packet.severity = level_map[log.level]
52
- packet.to_s
53
+ packet.assemble(@max_size)
53
54
  end
54
55
  end
55
56
  end
@@ -1,3 +1,3 @@
1
1
  module SemanticLogger
2
- VERSION = "4.7.1".freeze
2
+ VERSION = "4.7.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semantic_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.1
4
+ version: 4.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-14 00:00:00.000000000 Z
11
+ date: 2020-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby