Skip to content
Snippets Groups Projects
Unverified Commit f0d4aeec authored by bougyman's avatar bougyman Committed by GitHub
Browse files

Merge pull request #230 from TheNotary/allow-config-option-to-set-loglevel

adds log_level setting to bot configuration
parents c66bbe78 3a4e58b2
No related branches found
No related tags found
No related merge requests found
......@@ -443,3 +443,12 @@ Default value
Description
: Give up connecting after this amount of seconds.
## default_logger_level
Type
: Symbol
Default value
: `:debug`
Description
: Modify the log level of the default logger, for instance, the bot will log very little if you set this value to `:fatal`.
......@@ -332,10 +332,10 @@ module Cinch
# @yield
def initialize(&b)
@loggers = LoggerList.new
@loggers << Logger::FormattedLogger.new($stderr)
@config = Configuration::Bot.new
@loggers = LoggerList.new
@loggers << Logger::FormattedLogger.new($stderr, level: @config.default_logger_level)
@handlers = HandlerList.new
@semaphores_mutex = Mutex.new
@semaphores = Hash.new { |h, k| h[k] = Mutex.new }
......
......@@ -8,7 +8,7 @@ module Cinch
:realname, :user, :messages_per_second, :server_queue_size,
:strictness, :message_split_start, :message_split_end,
:max_messages, :plugins, :channels, :encoding, :reconnect, :max_reconnect_delay,
:local_host, :timeouts, :ping_interval, :delay_joins, :dcc, :shared, :sasl]
:local_host, :timeouts, :ping_interval, :delay_joins, :dcc, :shared, :sasl, :default_logger_level]
# (see Configuration.default_config)
def self.default_config
......@@ -40,6 +40,7 @@ module Cinch
:dcc => Configuration::DCC.new,
:sasl => Configuration::SASL.new,
:shared => {},
:default_logger_level => :debug
}
end
end
......
......@@ -20,10 +20,10 @@ module Cinch
attr_reader :output
# @param [IO] output The I/O object to write log data to
def initialize(output)
def initialize(output, level: :debug)
@output = output
@mutex = Mutex.new
@level = :debug
@level = level
end
# Logs a debugging message.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment