D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Logger
/
Filename :
formatter-i.ri
back
Copy
U:RDoc::Attr[iI"formatter:ETI"Logger#formatter;TI"RW;T:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"7Sets or retrieves the logger entry formatter proc.;To:RDoc::Markup::BlankLine o; ; [I"BWhen +formatter+ is +nil+, the logger uses Logger::Formatter.;T@o; ; [I"GWhen +formatter+ is a proc, a new entry is formatted by the proc, ;TI")which is called with four arguments:;T@o:RDoc::Markup::List: @type:BULLET:@items[ o:RDoc::Markup::ListItem:@label0; [o; ; [I"++severity+: The severity of the entry.;To;;0; [o; ; [I">+time+: A Time object representing the entry's timestamp.;To;;0; [o; ; [I"0+progname+: The program name for the entry.;To;;0; [o; ; [I"L+msg+: The message for the entry (string or string-convertible object).;T@o; ; [I"DThe proc should return a string containing the formatted entry.;T@o; ; [I" This custom formatter uses ;TI"){String#dump}[rdoc-ref:String#dump] ;TI""to escape the message string:;T@o:RDoc::Markup::Verbatim; [I"4logger = Logger.new($stdout, progname: 'mung') ;TI"Doriginal_formatter = logger.formatter || Logger::Formatter.new ;TI"?logger.formatter = proc { |severity, time, progname, msg| ;TI"C original_formatter.call(severity, time, progname, msg.dump) ;TI"} ;TI"-logger.add(Logger::INFO, "hello \n ''") ;TI"0logger.add(Logger::INFO, "\f\x00\xff\\\"") ;T:@format0o; ; [I"Output:;T@o;; [I"HI, [2022-05-13T13:16:29.637488 #8492] INFO -- mung: "hello \n ''" ;TI"JI, [2022-05-13T13:16:29.637610 #8492] INFO -- mung: "\f\x00\xFF\\\"";T;0: @fileI"lib/logger.rb;T:0@omit_headings_from_table_of_contents_below0F@EI"Logger;TcRDoc::NormalClass0