Class: Eye::Logger
Direct Known Subclasses
Defined Under Namespace
Modules: ObjectExt Classes: InnerLogger
Class Attribute Summary collapse
-
.args ⇒ Object
readonly
Returns the value of attribute args.
-
.dev ⇒ Object
readonly
Returns the value of attribute dev.
-
.log_level ⇒ Object
Returns the value of attribute log_level.
Instance Attribute Summary collapse
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#subprefix ⇒ Object
Returns the value of attribute subprefix.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(prefix = nil, subprefix = nil) ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize(prefix = nil, subprefix = nil) ⇒ Logger
Returns a new instance of Logger.
54 55 56 57 |
# File 'lib/eye/logger.rb', line 54 def initialize(prefix = nil, subprefix = nil) @prefix = prefix @subprefix = subprefix end |
Class Attribute Details
.args ⇒ Object (readonly)
Returns the value of attribute args.
60 61 62 |
# File 'lib/eye/logger.rb', line 60 def args @args end |
.dev ⇒ Object (readonly)
Returns the value of attribute dev.
60 61 62 |
# File 'lib/eye/logger.rb', line 60 def dev @dev end |
.log_level ⇒ Object
Returns the value of attribute log_level.
60 61 62 |
# File 'lib/eye/logger.rb', line 60 def log_level @log_level end |
Instance Attribute Details
#prefix ⇒ Object
Returns the value of attribute prefix.
4 5 6 |
# File 'lib/eye/logger.rb', line 4 def prefix @prefix end |
#subprefix ⇒ Object
Returns the value of attribute subprefix.
4 5 6 |
# File 'lib/eye/logger.rb', line 4 def subprefix @subprefix end |
Class Method Details
.inner_logger ⇒ Object
94 95 96 |
# File 'lib/eye/logger.rb', line 94 def inner_logger @inner_logger ||= InnerLogger.new(nil) end |
.link_logger(dev, *args) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/eye/logger.rb', line 62 def link_logger(dev, *args) old_dev = @dev @dev = @dev_fd = dev @args = args if dev.nil? @inner_logger = InnerLogger.new(nil) elsif dev.is_a?(String) @dev_fd = STDOUT if @dev.to_s.downcase == 'stdout' @dev_fd = STDERR if @dev.to_s.downcase == 'stderr' @inner_logger = InnerLogger.new(@dev_fd, *args) else @inner_logger = dev end @inner_logger.level = self.log_level || Logger::INFO rescue Exception @inner_logger = nil @dev = old_dev raise end |
.reopen ⇒ Object
85 86 87 |
# File 'lib/eye/logger.rb', line 85 def reopen link_logger(dev, *args) end |