Class: SmartProxyDynflowCore::Log
- Inherits:
-
Logger
- Object
- Logger
- SmartProxyDynflowCore::Log
show all
- Defined in:
- lib/smart_proxy_dynflow_core/log.rb
Defined Under Namespace
Classes: ProxyAdapter, ProxyStructuredFormater
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(file, *rest) ⇒ Log
42
43
44
45
46
47
|
# File 'lib/smart_proxy_dynflow_core/log.rb', line 42
def initialize(file, *rest)
@file = file
@fd = @file.is_a?(IO) ? @file : File.open(@file, 'a')
@fd.sync = true
super(@fd, rest)
end
|
Class Method Details
.instance ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/smart_proxy_dynflow_core/log.rb', line 8
def instance
if @logger.nil?
@logger = self.new log_file
@logger.level = log_level
end
@logger
end
|
.instance=(logger) ⇒ Object
16
17
18
|
# File 'lib/smart_proxy_dynflow_core/log.rb', line 16
def instance=(logger)
@logger = logger
end
|
.reload! ⇒ Object
20
21
22
23
|
# File 'lib/smart_proxy_dynflow_core/log.rb', line 20
def reload!
@logger = nil
instance
end
|
Instance Method Details
#roll_log ⇒ Object
49
50
51
52
53
54
|
# File 'lib/smart_proxy_dynflow_core/log.rb', line 49
def roll_log
unless @file.is_a? IO
@fd.reopen @file, 'a'
@fd.sync = true
end
end
|