Skip to content

Instantly share code, notes, and snippets.

[user]
name = ****
email = ****
[github]
user = ****
token = ****
[color]
branch = auto
diff = auto
status = auto
module ActiveSupport
# Format the buffered logger with timestamp/severity info.
class BufferedLogger
NUMBER_TO_NAME_MAP = {0=>'DEBUG', 1=>'INFO', 2=>'WARN', 3=>'ERROR', 4=>'FATAL', 5=>'UNKNOWN'}
NUMBER_TO_COLOR_MAP = {0=>'0;37', 1=>'32', 2=>'33', 3=>'31', 4=>'31', 5=>'37'}
def add(severity, message = nil, progname = nil, &block)
return if @level > severity
sevstring = NUMBER_TO_NAME_MAP[severity]
class ActiveSupport::BufferedLogger
def formatter=(formatter)
@log.formatter = formatter
end
end
class Formatter
SEVERITY_TO_TAG_MAP = {'DEBUG'=>'meh', 'INFO'=>'fyi', 'WARN'=>'hmm', 'ERROR'=>'wtf', 'FATAL'=>'omg', 'UNKNOWN'=>'???'}
SEVERITY_TO_COLOR_MAP = {'DEBUG'=>'0;37', 'INFO'=>'32', 'WARN'=>'33', 'ERROR'=>'31', 'FATAL'=>'31', 'UNKNOWN'=>'37'}
PROTOCOL_COLOR = 34