Class: Baleen::BL
- Inherits:
-
Object
- Object
- Baleen::BL
- Includes:
- Singleton
- Defined in:
- lib/baleen/utils/logger.rb
Instance Attribute Summary collapse
-
#log ⇒ Object
readonly
Returns the value of attribute log.
Class Method Summary collapse
- .debug(msg) ⇒ Object
- .error(msg) ⇒ Object
- .info(msg) ⇒ Object
- .notice(msg) ⇒ Object
- .warn(msg) ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ BL
constructor
A new instance of BL.
- #puts(msg) ⇒ Object
Constructor Details
#initialize ⇒ BL
Returns a new instance of BL.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/baleen/utils/logger.rb', line 28 def initialize config = Baleen::Configuration.instance if config.debug device = STDOUT else dir = File.join(config.dir, "log") FileUtils.mkdir_p dir device = File.join(dir, "baleen.log") Celluloid.logger = nil end @log = Logger.new(device) @log.level = config.log_level end |
Instance Attribute Details
#log ⇒ Object (readonly)
Returns the value of attribute log.
26 27 28 |
# File 'lib/baleen/utils/logger.rb', line 26 def log @log end |
Class Method Details
.debug(msg) ⇒ Object
58 59 60 61 |
# File 'lib/baleen/utils/logger.rb', line 58 def self.debug(msg) instance.log.debug(msg.magenta) EoL.new(Proc.new{instance.log.debug("")}) end |
.error(msg) ⇒ Object
43 44 45 46 |
# File 'lib/baleen/utils/logger.rb', line 43 def self.error(msg) instance.log.error(msg.red) EoL.new(Proc.new{instance.log.error("")}) end |
.info(msg) ⇒ Object
53 54 55 56 |
# File 'lib/baleen/utils/logger.rb', line 53 def self.info(msg) instance.log.info(msg) EoL.new(Proc.new{instance.log.info("")}) end |
Instance Method Details
#puts(msg) ⇒ Object
68 69 70 |
# File 'lib/baleen/utils/logger.rb', line 68 def puts(msg) log.info(msg) end |