lib/banana/logger.rb
# This method is the only method which sends the message `msg` to `@channel` via `@method`.
# It also increments the message counter `@logged` by one.
#
# This method instantly returns nil if the logger or the given log level `type` is disabled.
#
# @param [String] msg The message to send to the channel
# @param [Symbol] type The log level


This method instantly returns nil if the logger or the given log level `type` is disabled.
This method instantly returns nil if the logger or the given log level ` type ` is disabled .
def log msg, type = :info
      return if !@enabled || !@levels[type][:enabled]
      if @levels[type.to_sym] || !@levels.key?(type.to_sym)
        time = Time.at(Time.now.utc - @startup).utc
        timestr = @timestr ? "[#{time.strftime("%H:%M:%S.%L")} #{type.to_s.upcase}]\t" : ""
        if @colorize
          msg = "#{colorize(timestr, @levels[type.to_sym][:color])}" <<
                "#{@prefix}" <<
                "#{colorize(msg, @levels[type.to_sym][:color])}"
        else
          msg = "#{timestr}#{@prefix}#{msg}"
        end
        @logged += 1
        @channel.send(@method, msg)
      end
    end
def log msg , type = :info return if ! @enabled || ! @levels [ type ] [ :enabled ] if @levels [ type . to_sym ] || ! @levels . key? ( type . to_sym ) time = Time . at ( Time . now . utc - @startup ) . utc timestr = @timestr ? "[#{time.strftime("%H:%M:%S.%L")} #{type.to_s.upcase}]\t" : "" if @colorize msg = "#{colorize(timestr, @levels[type.to_sym][:color])}" << "#{@prefix}" << "#{colorize(msg, @levels[type.to_sym][:color])}" else msg = "#{timestr}#{@prefix}#{msg}" end @logged += 1 @channel . send ( @method , msg ) end end
This method is the only method which sends the message `msg` to `@channel` via `@method`.
This method is the only method which sends the message ` msg ` to ` @channel ` via ` @method ` .
msg
<not_specific>
type
<not_specific>
<not_specific>
type The log level
type The log level