rails_semantic_logger 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/lib/rails_semantic_logger/railtie.rb +15 -22
- data/lib/rails_semantic_logger/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 024e97863a3a7aff23f3c932001b3c98be23dfcd
|
4
|
+
data.tar.gz: a449a33f61c782f8462d917015da31c06a64fb68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92d5976475bcd7745a73aeaa6b53928a2c8e052fe92404f7d6c467a66d8299da21f3b6a3e364253d162580a290f5644adecd5b13ba82befef655e6f3aaa74ffc
|
7
|
+
data.tar.gz: 3bc2cc1e8890f40a13b0cfaa80e673292876999328e18cc21e4fec70842f4271939d052428b05fea5dd8712706807d982c2f44ade6175be120d94b9ea8ace02b
|
data/Rakefile
CHANGED
@@ -5,12 +5,12 @@ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
|
5
5
|
require 'rails_semantic_logger/version'
|
6
6
|
|
7
7
|
task :gem do
|
8
|
-
system
|
8
|
+
system 'gem build rails_semantic_logger.gemspec'
|
9
9
|
end
|
10
10
|
|
11
11
|
task :publish => :gem do
|
12
12
|
system "git tag -a v#{RailsSemanticLogger::VERSION} -m 'Tagging #{RailsSemanticLogger::VERSION}'"
|
13
|
-
system
|
13
|
+
system 'git push --tags'
|
14
14
|
system "gem push rails_semantic_logger-#{RailsSemanticLogger::VERSION}.gem"
|
15
15
|
system "rm rails_semantic_logger-#{RailsSemanticLogger::VERSION}.gem"
|
16
16
|
end
|
@@ -20,23 +20,19 @@ module RailsSemanticLogger #:nodoc:
|
|
20
20
|
# Initialize SemanticLogger. In a Rails environment it will automatically
|
21
21
|
# insert itself above the configured rails logger to add support for its
|
22
22
|
# additional features
|
23
|
-
#
|
24
|
-
# Loaded after Rails logging is initialized since SemanticLogger will continue
|
25
|
-
# to forward logging to the Rails Logger
|
26
23
|
|
27
|
-
#
|
28
|
-
|
29
|
-
Rails::Application::Bootstrap.initializers.delete_if{|i| i.name == :initialize_logger}
|
24
|
+
# Replace Rails logger initializer
|
25
|
+
Rails::Application::Bootstrap.initializers.delete_if { |i| i.name == :initialize_logger }
|
30
26
|
|
31
27
|
initializer :initialize_logger, group: :all do
|
32
|
-
config
|
28
|
+
config = Rails.application.config
|
33
29
|
|
34
30
|
# Set the default log level based on the Rails config
|
35
31
|
SemanticLogger.default_level = config.log_level
|
36
32
|
|
37
33
|
# Existing loggers are ignored because servers like trinidad supply their
|
38
34
|
# own file loggers which would result in duplicate logging to the same log file
|
39
|
-
Rails.logger
|
35
|
+
Rails.logger = config.logger = begin
|
40
36
|
# First check for Rails 3.2 path, then fallback to pre-3.2
|
41
37
|
path = ((config.paths.log.to_a rescue nil) || config.paths['log']).first
|
42
38
|
unless File.exist? File.dirname path
|
@@ -45,13 +41,13 @@ module RailsSemanticLogger #:nodoc:
|
|
45
41
|
|
46
42
|
# Set internal logger to log to file only, in case another appender
|
47
43
|
# experiences errors during writes
|
48
|
-
appender
|
49
|
-
appender.name
|
44
|
+
appender = SemanticLogger::Appender::File.new(path, config.log_level)
|
45
|
+
appender.name = 'SemanticLogger'
|
50
46
|
SemanticLogger::Logger.logger = appender
|
51
47
|
|
52
48
|
# Add the log file to the list of appenders
|
53
49
|
# Use the colorized formatter if Rails colorized logs are enabled
|
54
|
-
formatter
|
50
|
+
formatter = SemanticLogger::Appender::Base.colorized_formatter unless config.colorize_logging == false
|
55
51
|
SemanticLogger.add_appender(path, nil, &formatter)
|
56
52
|
SemanticLogger[Rails]
|
57
53
|
rescue StandardError => exc
|
@@ -70,13 +66,10 @@ module RailsSemanticLogger #:nodoc:
|
|
70
66
|
logger
|
71
67
|
end
|
72
68
|
|
73
|
-
# Replace
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
# Rails 4 is overwriting existing values for the logger, unless set via config
|
79
|
-
config.action_controller.logger = SemanticLogger['ActionController']
|
69
|
+
# Replace Rails loggers
|
70
|
+
[:active_record, :action_controller, :action_mailer, :action_view, :active_job].each do |name|
|
71
|
+
ActiveSupport.on_load(name) { include SemanticLogger::Loggable }
|
72
|
+
end
|
80
73
|
end
|
81
74
|
|
82
75
|
# Support fork frameworks
|
@@ -103,17 +96,17 @@ module RailsSemanticLogger #:nodoc:
|
|
103
96
|
# Before any initializers run, but after the gems have been loaded
|
104
97
|
config.before_initialize do
|
105
98
|
# Replace the Mongoid Logger
|
106
|
-
Mongoid.logger
|
107
|
-
Moped.logger
|
99
|
+
Mongoid.logger = SemanticLogger[Mongoid] if defined?(Mongoid)
|
100
|
+
Moped.logger = SemanticLogger[Moped] if defined?(Moped)
|
108
101
|
|
109
102
|
# Replace the Resque Logger
|
110
|
-
Resque.logger
|
103
|
+
Resque.logger = SemanticLogger[Resque] if defined?(Resque) && Resque.respond_to?(:logger)
|
111
104
|
|
112
105
|
# Replace the Sidekiq logger
|
113
106
|
Sidekiq::Logging.logger = SemanticLogger[Sidekiq] if defined?(Sidekiq)
|
114
107
|
|
115
108
|
# Replace the Sidetiq logger
|
116
|
-
Sidetiq.logger
|
109
|
+
Sidetiq.logger = SemanticLogger[Sidetiq] if defined?(Sidetiq)
|
117
110
|
|
118
111
|
# Replace the Bugsnag logger
|
119
112
|
Bugsnag.configure { |config| config.logger = SemanticLogger[Bugsnag] } if defined?(Bugsnag)
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_semantic_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reid Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semantic_logger
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: '2.20'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: '2.20'
|
27
27
|
description: Replaces the default Rails logger with SemanticLogger
|
28
28
|
email:
|
29
29
|
- reidmo@gmail.com
|
@@ -60,5 +60,5 @@ rubyforge_project:
|
|
60
60
|
rubygems_version: 2.4.5.1
|
61
61
|
signing_key:
|
62
62
|
specification_version: 4
|
63
|
-
summary: Scalable, next generation enterprise logging for
|
63
|
+
summary: Scalable, next generation enterprise logging for Rails
|
64
64
|
test_files: []
|