lapis 0.2.6 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/lapis.rb +11 -10
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da158cdc43e0f668c3d72e5823e57925ade07e58
4
- data.tar.gz: 14adaba9cb256702dfc45cf9d0ab7eaa014eeee2
3
+ metadata.gz: 42e36c63db5206c7f4f826119ef5cf93868aa414
4
+ data.tar.gz: 6e49dc0ca0f20b9bd81aa2fbbe9c91fbabc1220d
5
5
  SHA512:
6
- metadata.gz: 4001c6c5f63f26613d5df47a5dbd58143ee0f0199cd5ad3d086aafb422db56d1715ac041fcaac47c2606559d841ca36985166ae236f68581701dbb83ebd8f170
7
- data.tar.gz: c18b254d312de0b096807c04fb5ce5fa3f46dfbf4e2aeb33575bccc6adc1078d8f46f83f860297afb8626ce463140830bf076cc3598762a0bfe1449bbcd925ea
6
+ metadata.gz: b1c5352ecd0c3c1b8c1882b3710c4bf8a46802b64d0fef0c57e9b61c9711aaf24693a4808092066e7613f776278cae10b62b5e78e52dbfa8c06b1fe0a4d15872
7
+ data.tar.gz: 851d107472c602dd6af27a3f8290450f35cab7eaae279a9e95298ed37ef9a42c9188a41b4c0de015e6b3ea997af4163f6d149bcde5c9e6f80e5e2f919a8e6523
data/lib/lapis.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Lapis
2
2
 
3
- VERSION = '0.2.6'
3
+ VERSION = '1.0.0'
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:
@@ -8,13 +8,19 @@ module Lapis
8
8
  # its' documentation for more info.
9
9
  # * +formatter+ -- A lambda, used for formatting output. Upon a call to log,
10
10
  # this will be called with the severity of the message and the message
11
- # itself (in that order).
11
+ # itself.
12
12
  # * +output_channel+ -- An IO object, representing the destination for all
13
13
  # output.
14
14
  class Logger
15
15
 
16
16
  # Special levels that will be sent to +@levels+ as method calls.
17
17
  DELEGATE_LEVELS = [:first, :last]
18
+
19
+ # The default value of +@levels+.
20
+ DEFAULT_LEVELS = [:debug, :info, :warn, :error, :fatal]
21
+
22
+ # The default value of +@level+.
23
+ DEFAULT_LEVEL = :info
18
24
 
19
25
  # An array of all valid severity levels. Each levels' offset in this array
20
26
  # determines its relative importance.
@@ -33,23 +39,18 @@ module Lapis
33
39
  # @return [IO]
34
40
  attr_reader :output_channel
35
41
 
36
- def initialize(out = $stdout, level = :info,
37
- levels = [:debug, :info, :warn, :error, :fatal])
38
-
42
+ def initialize(out=$stdout, level=DEFAULT_LEVEL, levels=DEFAULT_LEVELS)
39
43
  @output_channel = out
40
44
  @levels = levels
41
45
  @level = level
42
- @formatter = lambda do |level, msg|
43
- output_channel.print "#{level}: #{msg}\n"
44
- end
46
+ @formatter = -> (level, msg) { output_channel.print "#{level}: #{msg}\n" }
45
47
  end
46
48
 
47
49
  # A factory method for logging to files. Functions exactly as the regular
48
50
  # +new+ method, expect instead of expecting an IO object, it expects the
49
51
  # name of a file.
50
52
  # @param file [String] the name of the file to log output to
51
- def self.open(file, level = :info,
52
- levels = [:debug, :info, :warn, :error, :fatal])
53
+ def self.open(file, level=DEFAULT_LEVEL, levels=DEFAULT_LEVELS)
53
54
  new(File.open(file, "w"), level, levels)
54
55
  end
55
56
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lapis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Citruxy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-06 00:00:00.000000000 Z
11
+ date: 2013-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler