log_runes 1.3 → 1.4
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/LICENSE.txt +2 -2
- data/lib/log_runes/custom_log_renamer.rb +21 -0
- data/lib/log_runes/logger_factory.rb +5 -12
- data/lib/log_runes/version.rb +1 -1
- data/lib/log_runes.rb +1 -0
- data/log_runes.gemspec +2 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 442df79d8ba45c5d5958d37cd46a20edbdfc8ab5
|
4
|
+
data.tar.gz: dee577e80bcb1bc4729b3204c255eadf5ac29483
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ba0118e67db439fda71f6ec0c5cf7cc4ce1b4525290893a07cf25c618afad141d90609916cb97bb60ebba634bbfb9c39b903cd472b305558286dc4f1eb88815
|
7
|
+
data.tar.gz: 7d73563cbe91eb46030f701fd5f4d0ed9fbf2fefa29ef167b187deead208026406b1ffe849d36b8699d4cfc37a3381081451442c27de7efc1a9f291e471f23e7
|
data/LICENSE.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2013 William Lipa
|
1
|
+
Copyright (c) 2013-2015 William Lipa
|
2
2
|
|
3
3
|
MIT License
|
4
4
|
|
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Logger
|
2
|
+
class LogDevice
|
3
|
+
|
4
|
+
private
|
5
|
+
|
6
|
+
alias_method :orig_shift_log_period, :shift_log_period
|
7
|
+
|
8
|
+
# Override the shift method to allow us to control the file name.
|
9
|
+
def shift_log_period(period_end)
|
10
|
+
orig_shift_log_period(period_end)
|
11
|
+
log_dir = File.dirname(@filename)
|
12
|
+
return true unless File.directory?("#{log_dir}/rot") # standard behavior unless rot dir exists
|
13
|
+
Dir.glob("#{@filename}.*").each do |fn|
|
14
|
+
base = File.basename(fn).gsub(/\.log\.(\d\d\d\d)(\d\d)(\d\d)$/, '-\1-\2-\3.log')
|
15
|
+
File.rename fn, "#{log_dir}/rot/#{base}"
|
16
|
+
end
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -1,26 +1,19 @@
|
|
1
1
|
module LogRunes
|
2
2
|
class LoggerFactory
|
3
|
-
|
4
|
-
|
3
|
+
|
5
4
|
def self.set(config, opts)
|
6
5
|
|
7
6
|
if Rails.env.development? || Rails.env.test?
|
8
7
|
# Use a stdout logger to avoid piling up a mostly useless giant log file
|
9
|
-
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
|
-
return if opts[:no_cronolog]
|
14
|
-
cronolog_path = opts[:cronolog_path] || '/usr/bin/cronolog'
|
15
|
-
unless File.exists? cronolog_path
|
16
|
-
puts "cronolog missing - reverting to standard logger"
|
8
|
+
stdout_logger = Logger.new(STDOUT)
|
9
|
+
config.logger = ActiveSupport::TaggedLogging.new(stdout_logger)
|
17
10
|
return
|
18
11
|
end
|
19
12
|
|
20
13
|
log_base = opts[:dir] || "#{Rails.root}/log"
|
21
14
|
log_name = opts[:name] || Rails.env
|
22
|
-
|
23
|
-
|
15
|
+
l = Logger.new("#{log_base}/#{log_name}.log", 'daily')
|
16
|
+
|
24
17
|
config.logger = opts[:not_tagged] ? l : ActiveSupport::TaggedLogging.new(l)
|
25
18
|
|
26
19
|
end
|
data/lib/log_runes/version.rb
CHANGED
data/lib/log_runes.rb
CHANGED
data/log_runes.gemspec
CHANGED
@@ -16,4 +16,6 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.required_ruby_version = '>= 2.2.0' # cleaner log file rotation
|
19
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: log_runes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wlipa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Encodes session and request ids into the Rails log output using Unicode
|
14
14
|
single-width characters, thereby using only a minimum amount of column width but
|
@@ -25,6 +25,7 @@ files:
|
|
25
25
|
- README.md
|
26
26
|
- Rakefile
|
27
27
|
- lib/log_runes.rb
|
28
|
+
- lib/log_runes/custom_log_renamer.rb
|
28
29
|
- lib/log_runes/logger_factory.rb
|
29
30
|
- lib/log_runes/session_request_tagger.rb
|
30
31
|
- lib/log_runes/version.rb
|
@@ -40,7 +41,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
40
41
|
requirements:
|
41
42
|
- - ">="
|
42
43
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
44
|
+
version: 2.2.0
|
44
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
46
|
requirements:
|
46
47
|
- - ">="
|
@@ -48,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
49
|
version: '0'
|
49
50
|
requirements: []
|
50
51
|
rubyforge_project:
|
51
|
-
rubygems_version: 2.
|
52
|
+
rubygems_version: 2.4.5
|
52
53
|
signing_key:
|
53
54
|
specification_version: 4
|
54
55
|
summary: Encodes session and request ids into the Rails log output for easy grepping
|