module Yologga
Constants
- VERSION
Attributes
gzip[R]
logs_lifetime[R]
Public Class Methods
add_hourly_rotation_period_support!()
click to toggle source
# File lib/yologga.rb, line 15 def add_hourly_rotation_period_support! if hourly_mixin Logger::LogDevice.prepend(hourly_mixin) else warn unsupported_warning end end
default_rotation_period=(period)
click to toggle source
Calls superclass method
# File lib/yologga.rb, line 23 def default_rotation_period=(period) raise unsupported_warning if period == "hourly" && !hourly_mixin mixin = Module.new do define_method(:initialize) do |logdev, shift_age = period, *args| super(logdev, shift_age, *args) end end Logger.prepend(mixin) end
gzip=(enabled)
click to toggle source
Args¶ ↑
enabled
-
Boolean true of false
Examples¶ ↑
Yologga.gzip
= false Yologga.gzip
= true
Return¶ ↑
supplied value or raises an Error
# File lib/yologga.rb, line 52 def gzip=(enabled) raise unable_to_find_gzip if enabled && !system("gzip --help &> /dev/null") @gzip = enabled end
logs_lifetime=(logs_lifetime)
click to toggle source
Args¶ ↑
logs_lifetime
-
ActiveSupport::Duration representing logs lifetime
Examples¶ ↑
Yologga.logs_lifetime
= 9.hours Yologga.logs_lifetime
= 30.days
Return¶ ↑
supplied value
# File lib/yologga.rb, line 74 def logs_lifetime=(logs_lifetime) @logs_lifetime = logs_lifetime end
Private Class Methods
hourly_mixin()
click to toggle source
# File lib/yologga.rb, line 80 def hourly_mixin return @mixin if defined?(@mixin) mixin_name = "Yologga::Patch::Ruby_#{RUBY_VERSION.split('.').first(2).join('_')}" @mixin = begin Module.const_get(mixin_name) rescue NameError nil end end
unable_to_find_gzip()
click to toggle source
# File lib/yologga.rb, line 91 def unable_to_find_gzip "Unable to find gzip in PATH environment variable." end
unsupported_warning()
click to toggle source
# File lib/yologga.rb, line 95 def unsupported_warning "Hourly log rotation period is not supported for Ruby #{RUBY_VERSION}" end