lapis 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/lapis.rb +11 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2546ee1dc6f51c35dc579fd0ed11bd64a853073
|
4
|
+
data.tar.gz: 3b781ae73e9e76bc06873139aebe266a28e2e536
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81204258584e455e293ce0369a44eac7cc7f90614d7f7b705323e0a41997f344eba907729e9a9c62ea1dca0740f21984919f429e259c62e2a39b18ea56d0d9c8
|
7
|
+
data.tar.gz: da48536200ddd3aeac5e1a1fc9dc8d88cab42d62fd5c28de2642237df2fef1ed3428f748892476b6023d650218c222e83ebea83d6b24e144fb6763b492371dfc
|
data/Rakefile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/lapis.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Lapis
|
2
2
|
|
3
|
-
VERSION = '1.2.
|
3
|
+
VERSION = '1.2.2'
|
4
4
|
|
5
5
|
# +Lapis::Logger+ is a simple, lightweight logging utility. It is fully
|
6
6
|
# customizable; in particular, you can customize the following:
|
@@ -16,11 +16,16 @@ module Lapis
|
|
16
16
|
# Special levels that will be sent to +@levels+ as method calls.
|
17
17
|
DELEGATE_LEVELS = [:first, :last]
|
18
18
|
|
19
|
-
# The default
|
19
|
+
# The default severity domain.
|
20
20
|
DEFAULT_LEVELS = [:debug, :info, :warn, :error, :fatal]
|
21
21
|
|
22
|
-
# The default
|
22
|
+
# The default severity threshhold.
|
23
23
|
DEFAULT_LEVEL = :info
|
24
|
+
|
25
|
+
# The default formatting function.
|
26
|
+
DEFAULT_FORMATTER = lambda do |level, msg|
|
27
|
+
output_channel.print "#{level}: #{msg}\n"
|
28
|
+
end
|
24
29
|
|
25
30
|
# An array of all valid severity levels. Each levels' offset in this array
|
26
31
|
# determines its relative importance.
|
@@ -39,11 +44,11 @@ module Lapis
|
|
39
44
|
# @return [IO]
|
40
45
|
attr_reader :output_channel
|
41
46
|
|
42
|
-
def initialize(out
|
47
|
+
def initialize(out = $stdout, level = DEFAULT_LEVEL, levels = DEFAULT_LEVELS)
|
43
48
|
@output_channel = out
|
44
49
|
@levels = levels
|
45
50
|
@level = level
|
46
|
-
@formatter =
|
51
|
+
@formatter = DEFAULT_FORMATTER
|
47
52
|
yield self if block_given?
|
48
53
|
end
|
49
54
|
|
@@ -52,7 +57,7 @@ module Lapis
|
|
52
57
|
# name of a file.
|
53
58
|
# @param file [String] the name of the file to log output to
|
54
59
|
# @return [Lapis::Logger]
|
55
|
-
def self.open(file, level=DEFAULT_LEVEL, levels=DEFAULT_LEVELS)
|
60
|
+
def self.open(file, level = DEFAULT_LEVEL, levels = DEFAULT_LEVELS)
|
56
61
|
new(File.open(file, "w"), level, levels)
|
57
62
|
end
|
58
63
|
|