-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathsimple_logger.rb
More file actions
38 lines (31 loc) · 762 Bytes
/
simple_logger.rb
File metadata and controls
38 lines (31 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#
# Copyright 2008-2010 Amazon.com, Inc. or its affiliates. All Rights Reserved.
class SimpleLogger
attr_accessor :level
def initialize
@level = :info
end
def puts(msg)
STDOUT.puts msg
end
def trace(msg)
if [:debug, :trace].include?(level) then
STDOUT.puts "#{Time.now.utc} TRACE " + msg
end
end
def info(msg)
if [:debug, :trace, :info].include?(level) then
STDOUT.puts "#{Time.now.utc} INFO " + msg
end
end
def error(msg)
if [:debug, :trace, :info, :error].include?(level) then
STDOUT.puts "#{Time.now.utc} ERROR " + msg
end
end
def fatal(msg)
if [:debug, :trace, :info, :error, :fatal].include?(level) then
STDOUT.puts "#{Time.now.utc} FATAL " + msg
end
end
end