outland-tag_runes 1.0.0 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07f173cc03377ce577805642a9058df35d55d63d
4
- data.tar.gz: 31c96cfa3adf59b23b271d3d1ae06f8a6154dcaa
3
+ metadata.gz: b0041da0204a138ad68c9b50d2e6d2184bbeca3b
4
+ data.tar.gz: 9578c026b45fb7bd1f0342e901721d0310374e9f
5
5
  SHA512:
6
- metadata.gz: 80e124536d45bf3e1b9a13b99aaf7ec64022db8b415267c80bade563687ef9cf422baabea42a669c871d54ad3d2467ac4b6bce04dfb1894f4ee1349682714379
7
- data.tar.gz: 6e230cf59991beea4197db2b3f086890c465190a62e7661a71c5787837ef5e82339988bd9fc12e743ff77a7db928611d5e7923067c806e8b932d8a93aa007df3
6
+ metadata.gz: 7c5733c26df6dff47380d8a28cf4e16d65372b38a6d6cc93a6ebd41b5f378497adcf5d205d9b9b9d84b7efb4f204d45454943744cf47238de195ded4a0b64ad1
7
+ data.tar.gz: 16f2176cc19f3810fdcae176a8ceb5b9c6d4000f6a9ae7ff2b2643c98d3ebaf29353bc6e24127e52b850e146a7cb6be3e3a42dee1a33174d88817c7d3ac45366
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ **1.1** (February 27, 2017)
2
+
3
+ * Rotational logger
4
+
1
5
  **1.0** (February 27, 2017)
2
6
 
3
7
  * Initial release
@@ -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
@@ -1,7 +1,7 @@
1
1
  module Outland
2
2
  module TagRunes
3
3
 
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
 
6
6
  end
7
7
  end
@@ -1,3 +1,5 @@
1
+ require 'outland/tag_runes/custom_log_renamer'
2
+ require 'outland/tag_runes/rotational_logger'
1
3
  require 'outland/tag_runes/version'
2
4
 
3
5
  module Outland
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.0.0
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