logjam_agent 0.15.1 → 0.16.0

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
  SHA1:
3
- metadata.gz: c8b2c42b9ca25001fdc15e4d730894ecc1d285a7
4
- data.tar.gz: d49adeef731f0f249bb71ada4e04d53915112195
3
+ metadata.gz: 27c960ded3fc0d72bf9712505dc0bae9b401c4ad
4
+ data.tar.gz: 9ffc60c42b42a2774f5e8652dd5696bbcfe8a599
5
5
  SHA512:
6
- metadata.gz: 06b8c8a018933b380890bec4417d7c88906aacb72ecda8b5a3c517c770fe9dbe7089f00b06b30c1e99d22ff898cc5c24df36180f9e5291131e2ed658917370b5
7
- data.tar.gz: cf1cbbb12041c874cf6bee550debfc537d0ca2658d9c5ab1433136686fa8a21813aa877b26a18c27bd62353e1f1f7487dc3cf232f7d7b4893086b4e6994f1295
6
+ metadata.gz: 4f33b5fc478e0d43f6f7aae8884cc809632b71747b772e5da4c1ac049266337a5f656dd569653772d34870dd6a058fd3671f140b6fd2c860c483f7c397abecda
7
+ data.tar.gz: 20aad7ff6e1fd3404112575aa182cfcadfc2f24e69e8ccce941127bfabb09cf9ab6ee63f5bdf86e4e961ad7d082d51528263ab9cf54ac480841714d3613ae2d5
data/README.md CHANGED
@@ -55,6 +55,14 @@ module LogjamAgent
55
55
  # to debug asset request handling.
56
56
  self.ignore_asset_requests = Rails.env.development?
57
57
 
58
+ # Configure log level for logging on disk: only lines with a log level
59
+ # greater than or equal to the specified one will be logged to disk.
60
+ # Defaults to Logger::INFO. Note that logjam_agent extends the standard
61
+ # logger log levels by the constant NONE, which indicates no logging.
62
+ # Also, setting the level has no effect on console logging in development.
63
+ # self.log_device_log_level = Logger::WARN # log warnings, errors, fatals and unknown log messages
64
+ # self.log_device_log_level = Logger::NONE # log nothing at all
65
+
58
66
  # Configure lines which will not be logged locally.
59
67
  # They will still be sent to the logjam server. Defaults to nil.
60
68
  self.log_device_ignored_lines = /^\s*Rendered/
data/lib/logjam_agent.rb CHANGED
@@ -41,6 +41,12 @@ if defined?(Rails) && Rails::VERSION::STRING >= "3.0"
41
41
  require "logjam_agent/railtie"
42
42
  end
43
43
 
44
+ # monkey patch log levels to include NONE
45
+ require 'logger'
46
+ module Logger::Severity
47
+ NONE = UNKNOWN + 1
48
+ end
49
+
44
50
  module LogjamAgent
45
51
 
46
52
  class ForwardingError < StandardError; end
@@ -126,7 +132,11 @@ module LogjamAgent
126
132
  mattr_accessor :max_bytes_all_lines
127
133
  self.max_bytes_all_lines = 1024 * 1024
128
134
 
129
- def self.log_to_log_device?(msg)
135
+ mattr_accessor :log_device_log_level
136
+ self.log_device_log_level = Logger::INFO
137
+
138
+ def self.log_to_log_device?(severity, msg)
139
+ return false if severity < log_device_log_level
130
140
  if override_global_ignore_lines?
131
141
  msg !~ request.log_device_ignored_lines
132
142
  else
@@ -77,7 +77,7 @@ module LogjamAgent
77
77
  request.add_exception(e)
78
78
  end
79
79
  end
80
- log_to_log_device = level > Logger::INFO || LogjamAgent.log_to_log_device?(message)
80
+ log_to_log_device = LogjamAgent.log_to_log_device?(severity, message)
81
81
  message = "#{tags_text}#{message}" unless tags_text.blank?
82
82
  time = Time.now
83
83
  if log_to_log_device
@@ -19,6 +19,7 @@ module LogjamAgent
19
19
  path = logjam_log_path(app)
20
20
  logger = LogjamAgent::BufferedLogger.new(path)
21
21
  logger.level = ::Logger.const_get(app.config.log_level.to_s.upcase)
22
+ LogjamAgent.log_device_log_level = logger.level
22
23
  logger.formatter = LogjamAgent::SyslogLikeFormatter.new
23
24
  logger.auto_flushing = false if Rails.env.production? && Rails::VERSION::STRING < "3.2"
24
25
  logger = ActiveSupport::TaggedLogging.new(logger) if Rails::VERSION::STRING >= "3.2"
@@ -1,3 +1,3 @@
1
1
  module LogjamAgent
2
- VERSION = "0.15.1"
2
+ VERSION = "0.16.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logjam_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Kaes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-05 00:00:00.000000000 Z
11
+ date: 2016-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake