Class: Telegram::BotManager::Logger
- Inherits:
-
Logger
- Object
- Logger
- Telegram::BotManager::Logger
- Defined in:
- lib/telegram/bot_manager/logger.rb
Direct Known Subclasses
Defined Under Namespace
Classes: DefaultFormatter, MultiIO
Constant Summary collapse
- LOG_DIR =
'log'
Instance Method Summary collapse
-
#initialize(log_file: nil, **args) ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize(log_file: nil, **args) ⇒ Logger
Returns a new instance of Logger.
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/telegram/bot_manager/logger.rb', line 40 def initialize(log_file: nil, **args) $stdout.sync = true if log_file Dir.mkdir(LOG_DIR) unless Dir.exist?(LOG_DIR) file = File.open("#{LOG_DIR}/#{log_file}", "a") end super(MultiIO.new(STDOUT, file), args) @default_formatter = DefaultFormatter.new end |