Class: HttpStreamingClient::CustomLoggerInternal
- Inherits:
-
Object
- Object
- HttpStreamingClient::CustomLoggerInternal
show all
- Defined in:
- lib/http_streaming_client/custom_logger.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of CustomLoggerInternal.
46
47
48
49
|
# File 'lib/http_streaming_client/custom_logger.rb', line 46
def initialize
@console = nil
@logfile = nil
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
51
52
53
54
55
56
57
|
# File 'lib/http_streaming_client/custom_logger.rb', line 51
def method_missing(name, *args)
if !@console.nil?
@console.method(name).call(args) unless name.to_s =~ /(unknown|fatal|error|warn|info|debug)/
@console.method(name).call(args[0])
end
@logfile.method(name).call(args[0]) unless @logfile.nil?
end
|
Instance Method Details
#console=(enable) ⇒ Object
66
67
68
69
70
71
|
# File 'lib/http_streaming_client/custom_logger.rb', line 66
def console=(enable)
return (@console = nil) if !enable
@console = Logger.new(STDOUT)
@console.formatter = ColoredLogFormatter.new
@console.level = Logger::INFO
end
|
#logfile=(enable) ⇒ Object
59
60
61
62
63
64
|
# File 'lib/http_streaming_client/custom_logger.rb', line 59
def logfile=(enable)
return (@logfile = nil) if !enable
@logfile = Logger.new("test.log")
@logfile.formatter = ColoredLogFormatter.new
@logfile.level = Logger::DEBUG
end
|