1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

fix indentation

This commit is contained in:
Vijay Dev 2011-04-23 02:53:30 +05:30
parent 98b700e0bf
commit b22f39ec6f

View file

@ -3421,11 +3421,11 @@ h4. +silence+
Silences every log level lesser to the specified one for the duration of the given block. Log level orders are: debug, info, error and fatal.
<ruby>
logger = Logger.new("log/development.log")
logger.silence(Logger::INFO) do
logger.debug("In space, no one can hear you scream.")
logger.info("Scream all you want, small mailman!")
end
logger = Logger.new("log/development.log")
logger.silence(Logger::INFO) do
logger.debug("In space, no one can hear you scream.")
logger.info("Scream all you want, small mailman!")
end
</ruby>
h4. +datetime_format=+
@ -3433,17 +3433,17 @@ h4. +datetime_format=+
Modifies the datetime format output by the formatter class associated with this logger. If the formatter class does not have a +datetime_format+ method then this is ignored.
<ruby>
class Logger::FormatWithTime < Logger::Formatter
cattr_accessor(:datetime_format) { "%Y%m%d%H%m%S" }
class Logger::FormatWithTime < Logger::Formatter
cattr_accessor(:datetime_format) { "%Y%m%d%H%m%S" }
def self.call(severity, timestamp, progname, msg)
"#{timestamp.strftime(datetime_format)} -- #{String === msg ? msg : msg.inspect}\n"
end
def self.call(severity, timestamp, progname, msg)
"#{timestamp.strftime(datetime_format)} -- #{String === msg ? msg : msg.inspect}\n"
end
end
logger = Logger.new("log/development.log")
logger.formatter = Logger::FormatWithTime
logger.info("<- is the current time")
logger = Logger.new("log/development.log")
logger.formatter = Logger::FormatWithTime
logger.info("<- is the current time")
</ruby>
NOTE: Defined in +active_support/core_ext/logger.rb+.