[前][次][番号順一覧][スレッド一覧]

ruby-changes:24373

From: drbrain <ko1@a...>
Date: Wed, 18 Jul 2012 09:27:15 +0900 (JST)
Subject: [ruby-changes:24373] drbrain:r36424 (trunk): * lib/logger.rb: Updated typos and output to match modern Logger

drbrain	2012-07-18 09:27:04 +0900 (Wed, 18 Jul 2012)

  New Revision: 36424

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36424

  Log:
    * lib/logger.rb:  Updated typos and output to match modern Logger
      output.  Patch by Marcus Stollsteimer.  [Bug #6738]

  Modified files:
    trunk/ChangeLog
    trunk/lib/logger.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 36423)
+++ ChangeLog	(revision 36424)
@@ -1,3 +1,8 @@
+Wed Jul 18 09:26:45 2012  Eric Hodel  <drbrain@s...>
+
+	* lib/logger.rb:  Updated typos and output to match modern Logger
+	  output.  Patch by Marcus Stollsteimer.  [Bug #6738]
+
 Wed Jul 18 07:59:29 2012  Takeyuki FUJIOKA  <xibbar@r...>
 
 	* lib/cgi/util.rb (CGI.escapeHTML,unescapeHTML): Add &apos; for HTML5 escaping.
Index: lib/logger.rb
===================================================================
--- lib/logger.rb	(revision 36423)
+++ lib/logger.rb	(revision 36424)
@@ -18,18 +18,19 @@
 #
 # The messages have associated levels, such as +INFO+ or +ERROR+ that indicate
 # their importance.  You can then give the Logger a level, and only messages
-# at that level of higher will be printed.
+# at that level or higher will be printed.
 #
 # The levels are:
 #
-# +FATAL+:: an unhandleable error that results in a program crash
-# +ERROR+:: a handleable error condition
-# +WARN+::  a warning
-# +INFO+::  generic (useful) information about system operation
-# +DEBUG+:: low-level information for developers
+# +UNKNOWN+:: An unknown message that should always be logged.
+# +FATAL+:: An unhandleable error that results in a program crash.
+# +ERROR+:: A handleable error condition.
+# +WARN+::  A warning.
+# +INFO+::  Generic (useful) information about system operation.
+# +DEBUG+:: Low-level information for developers.
 #
 # For instance, in a production system, you may have your Logger set to
-# +INFO+ or even +WARN+
+# +INFO+ or even +WARN+.
 # When you are developing the system, however, you probably
 # want to know about the program's internal state, and would set the Logger to
 # +DEBUG+.
@@ -51,8 +52,11 @@
 #
 # === Example
 #
-# This creates a logger to the standard output stream, with a level of +WARN+
+# This creates a Logger that outputs to the standard output stream, with a
+# level of +WARN+:
 #
+#   require 'logger'
+#
 #   log = Logger.new(STDOUT)
 #   log.level = Logger::WARN
 #
@@ -102,16 +106,16 @@
 # 3. Create a logger for the specified file.
 #
 #      file = File.open('foo.log', File::WRONLY | File::APPEND)
-#      # To create new (and to remove old) logfile, add File::CREAT like;
-#      #   file = open('foo.log', File::WRONLY | File::APPEND | File::CREAT)
+#      # To create new (and to remove old) logfile, add File::CREAT like:
+#      # file = File.open('foo.log', File::WRONLY | File::APPEND | File::CREAT)
 #      logger = Logger.new(file)
 #
-# 4. Create a logger which ages logfile once it reaches a certain size.  Leave
-#    10 "old log files" and each file is about 1,024,000 bytes.
+# 4. Create a logger which ages the logfile once it reaches a certain size.
+#    Leave 10 "old" log files where each file is about 1,024,000 bytes.
 #
 #      logger = Logger.new('foo.log', 10, 1024000)
 #
-# 5. Create a logger which ages logfile daily/weekly/monthly.
+# 5. Create a logger which ages the logfile daily/weekly/monthly.
 #
 #      logger = Logger.new('foo.log', 'daily')
 #      logger = Logger.new('foo.log', 'weekly')
@@ -124,13 +128,13 @@
 # +debug+.  +add+ is used below to log a message of an arbitrary (perhaps
 # dynamic) level.
 #
-# 1. Message in block.
+# 1. Message in a block.
 #
 #      logger.fatal { "Argument 'foo' not given." }
 #
 # 2. Message as a string.
 #
-#      logger.error "Argument #{ @foo } mismatch."
+#      logger.error "Argument #{@foo} mismatch."
 #
 # 3. With progname.
 #
@@ -168,31 +172,30 @@
 #
 #      logger.level = Logger::INFO
 #
-#      DEBUG < INFO < WARN < ERROR < FATAL < UNKNOWN
+#      # DEBUG < INFO < WARN < ERROR < FATAL < UNKNOWN
 #
-#
 # == Format
 #
 # Log messages are rendered in the output stream in a certain format by
 # default.  The default format and a sample are shown below:
 #
 # Log format:
-#   SeverityID, [Date Time mSec #pid] SeverityLabel -- ProgName: message
+#   SeverityID, [DateTime #pid] SeverityLabel -- ProgName: message
 #
 # Log sample:
-#   I, [Wed Mar 03 02:34:24 JST 1999 895701 #19074]  INFO -- Main: info.
+#   I, [1999-03-03T02:34:24.895701 #19074]  INFO -- Main: info.
 #
-# You may change the date and time format via #datetime_format=
+# You may change the date and time format via #datetime_format=.
 #
-#   logger.datetime_format = "%Y-%m-%d %H:%M:%S"
+#   logger.datetime_format = '%Y-%m-%d %H:%M:%S'
 #         # e.g. "2004-01-03 00:54:26"
 #
-# Or, you may change the overall format with #formatter= method.
+# Or, you may change the overall format via the #formatter= method.
 #
 #   logger.formatter = proc do |severity, datetime, progname, msg|
 #     "#{datetime}: #{msg}\n"
 #   end
-#   # e.g. "Thu Sep 22 08:51:08 GMT+9:00 2005: hello world"
+#   # e.g. "2005-09-22 08:51:08 +0900: hello world"
 #
 class Logger
   VERSION = "1.2.7"
@@ -213,17 +216,17 @@
 
   # Logging severity.
   module Severity
-    # Low-level information, mostly for developers
+    # Low-level information, mostly for developers.
     DEBUG = 0
-    # generic, useful information about system operation
+    # Generic (useful) information about system operation.
     INFO = 1
-    # a warning
+    # A warning.
     WARN = 2
-    # a handleable error condition
+    # A handleable error condition.
     ERROR = 3
-    # an unhandleable error that results in a program crash
+    # An unhandleable error that results in a program crash.
     FATAL = 4
-    # an unknown message that should always be logged
+    # An unknown message that should always be logged.
     UNKNOWN = 5
   end
   include Severity
@@ -231,7 +234,7 @@
   # Logging severity threshold (e.g. <tt>Logger::INFO</tt>).
   attr_accessor :level
 
-  # program name to include in log messages.
+  # Program name to include in log messages.
   attr_accessor :progname
 
   # Set date-time format.
@@ -249,9 +252,9 @@
   # Logging formatter, as a +Proc+ that will take four arguments and
   # return the formatted message. The arguments are:
   #
-  # +severity+:: The Severity of the log message
-  # +time+:: A Time instance representing when the message was logged
-  # +progname+:: The #progname configured, or passed to the logger method
+  # +severity+:: The Severity of the log message.
+  # +time+:: A Time instance representing when the message was logged.
+  # +progname+:: The #progname configured, or passed to the logger method.
   # +msg+:: The _Object_ the user passed to the log message; not necessarily a
   #         String.
   #
@@ -338,8 +341,8 @@
   #
   # +true+ if successful, +false+ otherwise.
   #
-  # When the given severity is not high enough (for this particular logger), log
-  # no message, and return +true+.
+  # When the given severity is not high enough (for this particular logger),
+  # log no message, and return +true+.
   #
   # === Description
   #
@@ -358,7 +361,7 @@
   #
   # * Logfile is not locked.
   # * Append open does not need to lock file.
-  # * If the OS which supports multi I/O, records possibly be mixed.
+  # * If the OS supports multi I/O, records possibly may be mixed.
   #
   def add(severity, message = nil, progname = nil, &block)
     severity ||= UNKNOWN
@@ -402,18 +405,17 @@
   #
   # :call-seq:
   #   info(message)
-  #   info(progname,&block)
+  #   info(progname, &block)
   #
   # Log an +INFO+ message.
   #
-  # +message+:: the message to log; does not need to be a String
-  # +progname+:: in the block form, this is the #progname to use in the
-  #              the log message.  The default can be set with #progname=
-  # <tt>&block</tt>:: evaluates to the message to log.  This is not evaluated
-  #                   unless the logger's level is sufficient
-  #                   to log the message.  This allows you to create
-  #                   potentially expensive logging messages that are
-  #                   only called when the logger is configured to show them.
+  # +message+:: The message to log; does not need to be a String.
+  # +progname+:: In the block form, this is the #progname to use in the
+  #              log message.  The default can be set with #progname=.
+  # +block+:: Evaluates to the message to log.  This is not evaluated unless
+  #           the logger's level is sufficient to log the message.  This
+  #           allows you to create potentially expensive logging messages that
+  #           are only called when the logger is configured to show them.
   #
   # === Examples
   #
@@ -463,7 +465,7 @@
 
   #
   # Log an +UNKNOWN+ message.  This will be printed no matter what the logger's
-  # level.
+  # level is.
   #
   # See #info for more information.
   #
@@ -480,7 +482,7 @@
 
 private
 
-  # Severity label for logging. (max 5 char)
+  # Severity label for logging (max 5 chars).
   SEV_LABEL = %w(DEBUG INFO WARN ERROR FATAL ANY)
 
   def format_severity(severity)
@@ -492,7 +494,7 @@
   end
 
 
-  # Default formatter for log messages
+  # Default formatter for log messages.
   class Formatter
     Format = "%s, [%s#%d] %5s -- %s: %s\n"
 
@@ -678,13 +680,13 @@
   #
   # == Description
   #
-  # Application -- Add logging support to your application.
+  # Application --- Add logging support to your application.
   #
   # == Usage
   #
   # 1. Define your application class as a sub-class of this class.
-  # 2. Override 'run' method in your class to do many things.
-  # 3. Instantiate it and invoke 'start'.
+  # 2. Override the +run+ method in your class to do many things.
+  # 3. Instantiate it and invoke #start.
   #
   # == Example
   #

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]