Skip to content

Instantly share code, notes, and snippets.

@y13i
Created May 2, 2014 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save y13i/fdb17086f4eddaf5386e to your computer and use it in GitHub Desktop.
Save y13i/fdb17086f4eddaf5386e to your computer and use it in GitHub Desktop.
標準出力しつつログファイルにも出力する
require "logger"
class PLogger
def initialize *args
@stdout = Logger.new STDOUT
@log = Logger.new *args
end
%w(debug info warn error fatal).each do |level|
define_method(level) do |*args|
[@stdout, @log].all? do |output|
output.send level, *args
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment