hansel_logger 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32090260fe141da45896c77f12d983be35e39bf4
4
- data.tar.gz: 2205cbd6dd74d2795c73c81351d98103770127e5
3
+ metadata.gz: 897585e985de70a2f27a9d22b5f162cfea42d0bf
4
+ data.tar.gz: 70044ff22516d0d1e3de27bf52571b25b6dff691
5
5
  SHA512:
6
- metadata.gz: 5a92ba60c115061cf62c1296feda1e0335409b3a4b6716efe9bf6c8966402ddd1d3fd9d7aa8c820369d68ea3f88f18b31f0d1ae6678867b6a4515e017fb402cb
7
- data.tar.gz: bee8716500a8ae44e59b6080b4a743cd336afc5524d65bc7ff5c58cd43211e9c14b9ecfcff3a364d3a1740c38816502f57be461dc2daf3ba12881da56dc13314
6
+ metadata.gz: a97b99ca04dd8bf98da24b2626eded0802475c49998e6ff922acd454bb0374638385b44dc3cc4a8dc99f92e26f6401a75cda10717ac28f0d287514a3f6c7aa59
7
+ data.tar.gz: e377cccb6dfe7634b3932badccef0cc1c7b4eccbf09f887600cc599b0471ee4ee82c9cce18abb6d0e3ab84c8a6b24f84a605305f137c561def24f98ae3a7cfe1
data/README.md CHANGED
@@ -7,7 +7,7 @@ A logging framework
7
7
  Add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
- gem 'hansel-logger'
10
+ gem 'hansel_logger'
11
11
  ```
12
12
 
13
13
  And then execute:
@@ -16,13 +16,15 @@ And then execute:
16
16
 
17
17
  Or install it yourself as:
18
18
 
19
- $ gem install hansel-logger
19
+ $ gem install hansel_logger
20
20
 
21
21
  ## Usage
22
22
 
23
23
  Use it just like Logger! The only difference is you need to specify the Unique Transaction ID (UTID) in `#new`. The `#new` method takes all of the same parameters as the `Logger` class, after the UTID.
24
24
 
25
- You can initialize Hansel just like you would Logger. For most use cases, you should log to STDOUT, which is the default. As such, `Hansel.new('utid')` will suffice in most cases.
25
+ You can initialize Hansel just like you would Logger. For most use cases, you should log to STDOUT, which is the default. As such, `Hansel::Logger.new('utid')` will suffice in most cases.
26
+
27
+ You can also set the log level of `Hansel` the same way you would the normal Ruby `Logger` class: `hansel.level = Logger::INFO`
26
28
 
27
29
  ## Development
28
30
 
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Jordan Stone"]
10
10
  spec.email = ["jordan@getnotion.com"]
11
11
 
12
- spec.summary = %q{Hansel is a custom Logger subclass for making it simpler to attach a unique transaction ID (UTID) to all log messages.}
13
- spec.description = %q{Hansel is a custom Logger subclass for making it simpler to attach a unique transaction ID (UTID) to all log messages.}
12
+ spec.summary = %q{Hansel is a custom logger for making it simpler to attach a unique transaction ID (UTID) to all log messages.}
13
+ spec.description = %q{Hansel is a custom logger for making it simpler to attach a unique transaction ID (UTID) to all log messages.}
14
14
  spec.homepage = "https://github.com/LoopLabsInc/hansel"
15
15
  spec.license = "MIT"
16
16
 
data/lib/hansel.rb CHANGED
@@ -1,38 +1,5 @@
1
1
  require "hansel/version"
2
- require 'logger'
2
+ require "hansel/logger"
3
3
 
4
4
  module Hansel
5
- def initialize(utid, name=STDOUT, shift_age = 7, shift_size = 1048576)
6
- @utid = utid
7
- @logger = Logger.new(name, shift_age, shift_size)
8
- @logger.level = Logger::DEBUG
9
- end
10
-
11
- def utid
12
- @utid
13
- end
14
-
15
- def level=(level)
16
- @logger.level = level
17
- end
18
-
19
- def debug(message)
20
- @logger.debug "#{@utid} ~~ #{message}"
21
- end
22
-
23
- def error(message)
24
- @logger.error "#{@utid} ~~ #{message}"
25
- end
26
-
27
- def fatal(message)
28
- @logger.fatal "#{@utid} ~~ #{message}"
29
- end
30
-
31
- def info(message)
32
- @logger.info "#{@utid} ~~ #{message}"
33
- end
34
-
35
- def warn(message)
36
- @logger.warn "#{@utid} ~~ #{message}"
37
- end
38
- end
5
+ end
@@ -0,0 +1,39 @@
1
+ require 'logger'
2
+
3
+ module Hansel
4
+ class Logger
5
+ def initialize(utid, name=STDOUT, shift_age = 7, shift_size = 1048576)
6
+ @utid = utid
7
+ @logger = ::Logger.new(name, shift_age, shift_size)
8
+ @logger.level = ::Logger::DEBUG
9
+ end
10
+
11
+ def utid
12
+ @utid
13
+ end
14
+
15
+ def level=(level)
16
+ @logger.level = level
17
+ end
18
+
19
+ def debug(message)
20
+ @logger.debug "#{@utid} ~~ #{message}"
21
+ end
22
+
23
+ def error(message)
24
+ @logger.error "#{@utid} ~~ #{message}"
25
+ end
26
+
27
+ def fatal(message)
28
+ @logger.fatal "#{@utid} ~~ #{message}"
29
+ end
30
+
31
+ def info(message)
32
+ @logger.info "#{@utid} ~~ #{message}"
33
+ end
34
+
35
+ def warn(message)
36
+ @logger.warn "#{@utid} ~~ #{message}"
37
+ end
38
+ end
39
+ end
@@ -1,3 +1,3 @@
1
1
  module Hansel
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hansel_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Stone
@@ -38,8 +38,8 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- description: Hansel is a custom Logger subclass for making it simpler to attach a
42
- unique transaction ID (UTID) to all log messages.
41
+ description: Hansel is a custom logger for making it simpler to attach a unique transaction
42
+ ID (UTID) to all log messages.
43
43
  email:
44
44
  - jordan@getnotion.com
45
45
  executables: []
@@ -56,6 +56,7 @@ files:
56
56
  - bin/setup
57
57
  - hansel_logger.gemspec
58
58
  - lib/hansel.rb
59
+ - lib/hansel/logger.rb
59
60
  - lib/hansel/version.rb
60
61
  homepage: https://github.com/LoopLabsInc/hansel
61
62
  licenses:
@@ -80,6 +81,6 @@ rubyforge_project:
80
81
  rubygems_version: 2.4.6
81
82
  signing_key:
82
83
  specification_version: 4
83
- summary: Hansel is a custom Logger subclass for making it simpler to attach a unique
84
- transaction ID (UTID) to all log messages.
84
+ summary: Hansel is a custom logger for making it simpler to attach a unique transaction
85
+ ID (UTID) to all log messages.
85
86
  test_files: []