outland-tag_runes 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/outland/tag_runes/custom_log_renamer.rb +21 -0
- data/lib/outland/tag_runes/rotational_logger.rb +21 -0
- data/lib/outland/tag_runes/version.rb +1 -1
- data/lib/outland/tag_runes.rb +2 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0041da0204a138ad68c9b50d2e6d2184bbeca3b
|
4
|
+
data.tar.gz: 9578c026b45fb7bd1f0342e901721d0310374e9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c5733c26df6dff47380d8a28cf4e16d65372b38a6d6cc93a6ebd41b5f378497adcf5d205d9b9b9d84b7efb4f204d45454943744cf47238de195ded4a0b64ad1
|
7
|
+
data.tar.gz: 16f2176cc19f3810fdcae176a8ceb5b9c6d4000f6a9ae7ff2b2643c98d3ebaf29353bc6e24127e52b850e146a7cb6be3e3a42dee1a33174d88817c7d3ac45366
|
data/CHANGELOG.md
CHANGED
@@ -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
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Outland
|
2
|
+
module TagRunes
|
3
|
+
|
4
|
+
|
5
|
+
class RotationalLogger
|
6
|
+
|
7
|
+
def self.set(config)
|
8
|
+
logger = if Rails.env.development? || Rails.env.test?
|
9
|
+
ActiveSupport::Logger.new(STDOUT)
|
10
|
+
else
|
11
|
+
ActiveSupport::Logger.new("#{Rails.root}/log/rails.log", 'daily')
|
12
|
+
end
|
13
|
+
logger.formatter = config.log_formatter
|
14
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
data/lib/outland/tag_runes.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: outland-tag_runes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bill Lipa
|
@@ -68,6 +68,8 @@ files:
|
|
68
68
|
- bin/console
|
69
69
|
- bin/setup
|
70
70
|
- lib/outland/tag_runes.rb
|
71
|
+
- lib/outland/tag_runes/custom_log_renamer.rb
|
72
|
+
- lib/outland/tag_runes/rotational_logger.rb
|
71
73
|
- lib/outland/tag_runes/version.rb
|
72
74
|
- outland-tag_runes.gemspec
|
73
75
|
homepage: https://github.com/outland/tag_runes
|