rails_semantic_logger 3.4.1 → 4.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rails_semantic_logger/engine.rb +9 -10
- data/lib/rails_semantic_logger/extensions/action_cable/tagged_logger_proxy.rb +0 -6
- data/lib/rails_semantic_logger/extensions/action_controller/log_subscriber.rb +6 -3
- data/lib/rails_semantic_logger/version.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 696c9a07884107bd9e5a7270edffd557bbec8f35
|
4
|
+
data.tar.gz: 93549d6e6705210ae9761921426a28ae780f8525
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f3da3aaaf4dd8efa1abe73576709a13158c28cefc0276ae8115004ba2f83bca36ca435c29d5ed19ce355d9c2a92d071780bd0c4fc405a86f1d16a10b7ce7099
|
7
|
+
data.tar.gz: 894cf27dad2070845c89a15afb2f9f27520f390e62fbccc60fefc6622d3109d9f111d84dc069e91a7767a6994a7581aa09c8bd7da0e624c17d345bf7bd6feb65
|
@@ -9,7 +9,7 @@ module RailsSemanticLogger
|
|
9
9
|
# # Add the MongoDB logger appender only once Rails is initialized
|
10
10
|
# config.after_initialize do
|
11
11
|
# appender = SemanticLogger::Appender::Mongo.new(
|
12
|
-
#
|
12
|
+
# uri: 'mongodb://127.0.0.1:27017/test'
|
13
13
|
# )
|
14
14
|
# config.semantic_logger.add_appender(appender: appender)
|
15
15
|
# end
|
@@ -50,7 +50,7 @@ module RailsSemanticLogger
|
|
50
50
|
# When Semantic Logger fails to log to an appender it logs the error to an
|
51
51
|
# internal logger, which by default writes to STDERR.
|
52
52
|
# Example, change the default internal logger to log to stdout:
|
53
|
-
# SemanticLogger::
|
53
|
+
# SemanticLogger::Processor.logger = SemanticLogger::Appender::File.new(STDOUT, :warn)
|
54
54
|
config.rails_semantic_logger.add_file_appender = true
|
55
55
|
|
56
56
|
# Initialize SemanticLogger. In a Rails environment it will automatically
|
@@ -75,13 +75,13 @@ module RailsSemanticLogger
|
|
75
75
|
|
76
76
|
# Add the log file to the list of appenders
|
77
77
|
# Use the colorized formatter if Rails colorized logs are enabled
|
78
|
-
ap_options
|
79
|
-
formatter
|
78
|
+
ap_options = config.rails_semantic_logger.ap_options
|
79
|
+
formatter = config.colorize_logging == false ? SemanticLogger::Formatters::Default.new : SemanticLogger::Formatters::Color.new(ap: ap_options)
|
80
80
|
|
81
81
|
# Set internal logger to log to file only, in case another appender experiences errors during writes
|
82
|
-
appender
|
83
|
-
appender.name
|
84
|
-
SemanticLogger::
|
82
|
+
appender = SemanticLogger::Appender::File.new(file_name: path, level: config.log_level, formatter: formatter)
|
83
|
+
appender.name = 'SemanticLogger'
|
84
|
+
SemanticLogger::Processor.logger = appender
|
85
85
|
|
86
86
|
# Check for previous file or stdout loggers
|
87
87
|
SemanticLogger.appenders.each { |appender| appender.formatter = formatter if appender.is_a?(SemanticLogger::Appender::File) }
|
@@ -92,7 +92,7 @@ module RailsSemanticLogger
|
|
92
92
|
# If not able to log to file, log to standard error with warning level only
|
93
93
|
SemanticLogger.default_level = :warn
|
94
94
|
|
95
|
-
SemanticLogger::
|
95
|
+
SemanticLogger::Processor.logger = SemanticLogger::Appender::File.new(io: STDERR)
|
96
96
|
SemanticLogger.add_appender(io: STDERR)
|
97
97
|
|
98
98
|
logger = SemanticLogger[Rails]
|
@@ -134,10 +134,9 @@ module RailsSemanticLogger
|
|
134
134
|
|
135
135
|
# Before any initializers run, but after the gems have been loaded
|
136
136
|
config.before_initialize do
|
137
|
-
# Replace the
|
137
|
+
# Replace the Mongoid Logger
|
138
138
|
Mongoid.logger = SemanticLogger[Mongoid] if defined?(Mongoid)
|
139
139
|
Moped.logger = SemanticLogger[Moped] if defined?(Moped)
|
140
|
-
Mongo::Logger.logger = SemanticLogger[Mongo] if defined?(Mongo::Logger)
|
141
140
|
|
142
141
|
# Replace the Resque Logger
|
143
142
|
Resque.logger = SemanticLogger[Resque] if defined?(Resque) && Resque.respond_to?(:logger)
|
@@ -7,12 +7,6 @@ module ActionCable
|
|
7
7
|
def tag_logger(*tags, &block)
|
8
8
|
logger.tagged(*tags, &block)
|
9
9
|
end
|
10
|
-
|
11
|
-
# Rails 5 Beta 1,2. TODO: Remove once Rails 5 is GA
|
12
|
-
def tag(logger, &block)
|
13
|
-
current_tags = tags - logger.tags
|
14
|
-
logger.tagged(*current_tags, &block)
|
15
|
-
end
|
16
10
|
end
|
17
11
|
end
|
18
12
|
end
|
@@ -30,12 +30,15 @@ module ActionController
|
|
30
30
|
payload[key] = payload[key].to_f.round(2) if key.to_s.match(/(.*)_runtime/)
|
31
31
|
end
|
32
32
|
|
33
|
-
payload[:message] = "Completed ##{payload[:action]}"
|
34
33
|
payload[:status_message] = Rack::Utils::HTTP_STATUS_CODES[payload[:status]] if payload[:status].present?
|
35
|
-
payload[:duration] = event.duration
|
36
34
|
# Causes excessive log output with Rails 5 RC1
|
37
35
|
payload.delete(:headers)
|
38
|
-
|
36
|
+
|
37
|
+
{
|
38
|
+
message: "Completed ##{payload[:action]}",
|
39
|
+
duration: event.duration,
|
40
|
+
payload: payload
|
41
|
+
}
|
39
42
|
end
|
40
43
|
end
|
41
44
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_semantic_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reid Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.0'
|
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: '
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: semantic_logger
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 4.0.0.beta1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 4.0.0.beta1
|
41
41
|
description: Replaces the default Rails logger with SemanticLogger
|
42
42
|
email:
|
43
43
|
- reidmo@gmail.com
|
@@ -76,12 +76,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
76
|
requirements:
|
77
77
|
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: '
|
79
|
+
version: '2.1'
|
80
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- - "
|
82
|
+
- - ">"
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
84
|
+
version: 1.3.1
|
85
85
|
requirements: []
|
86
86
|
rubyforge_project:
|
87
87
|
rubygems_version: 2.6.8
|