Sha256: 958b4555efcf7380d03f31c33c85bf723d354ed04bd785ae3d330ebd7a4e7d2e
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
# -*- mode: ruby -*- # # logger.rb - logger implementation # # Copyright (C) 2004-2005 Satoru Takabayashi <satoru@namazu.org> # All rights reserved. # This is free software with ABSOLUTELY NO WARRANTY. # # You can redistribute it and/or modify it under the terms of # the GNU General Public License version 2. # module Gonzui class Logger def initialize(out = nil, verbose_p = false) @verbose_p = verbose_p @out = case out when String File.open(out, "a") when NilClass STDERR else out end @out.sync = true @monitor = nil end attr_writer :monitor private def puts_log(format, *arguments) time = Time.now.strftime("%Y-%m-%dT%H:%M:%S") message = "" message << time << " " << sprintf(format, *arguments) << "\n" @out << message @monitor << message if @monitor end public def log(format, *arguments) puts_log(format, *arguments) end def vlog(format, *arguments) puts_log(format, *arguments) if @verbose_p end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gonzui-1.2-x86-mswin32-60 | lib/gonzui/logger.rb |
gonzui-1.2 | lib/gonzui/logger.rb |