summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-23 14:12:42 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-23 14:12:42 +0000
commit3d69d318934beaf330e0ec7670606318a49e3c40 (patch)
tree9f9047c7f6c90730fa200165c4c548bea323161c /lib
parentaadc4feba1d160b514cc3a88f6caeae54a120195 (diff)
downloadruby-3d69d318934beaf330e0ec7670606318a49e3c40.tar.gz
ruby-3d69d318934beaf330e0ec7670606318a49e3c40.tar.xz
ruby-3d69d318934beaf330e0ec7670606318a49e3c40.zip
* lib/logger.rb: add Logger#<<(msg) for writing msg without any formatting.
* test/logger/test_logger.rb: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/logger.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/logger.rb b/lib/logger.rb
index 7e8134eee..04a106b44 100644
--- a/lib/logger.rb
+++ b/lib/logger.rb
@@ -186,6 +186,24 @@ class Logger
alias log add
# SYNOPSIS
+ # Logger#<<(msg)
+ #
+ # ARGS
+ # msg Message.
+ #
+ # RETURN
+ # Same as IO#<<. If logdev is not given, returns nil.
+ #
+ # DESCRIPTION
+ # Dump given message to log device without any formatting.
+ #
+ def <<(msg)
+ unless @logdev.nil?
+ @logdev.write(msg)
+ end
+ end
+
+ # SYNOPSIS
# Logger#debug(progname = nil) { ... } = nil
# Logger#info(progname = nil) { ... } = nil
# Logger#warn(progname = nil) { ... } = nil