simple_structured_logger 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37a960d5ba5cba7d48661a92378a88278af39dfb
4
- data.tar.gz: 59d65009423e48bc513e640d859521fcf1e30cbe
3
+ metadata.gz: 450b49d293e7743eaa62f2beb6c27cb3e02dea41
4
+ data.tar.gz: 8d8cc75dabd6c182f445f002e6724cc55d22bf74
5
5
  SHA512:
6
- metadata.gz: acdafee1c25ef8d234488ea38b10c93f436d4a2e860bff853ed02cc417b2c89ab22a8986e7ee1c1598a1ad1c4a36757d4aa081bd0b41d0370335d0aab334e7dd
7
- data.tar.gz: 8a9af6c2ce6b84b4e9e1c53ee1d22b710ad9caafa6d38de5c1c8991bdfbd094bfd34869f59e72520aa389ef06fbcecb9ed44fb5dac84223c6c79dcd930b18af7
6
+ metadata.gz: 83c99c8d4e03fbaba09731d2fb9f41d565b3ad89575ca7b79ff216781b079dad94aedc9b84e7f35f30e3d86d5a377107085a040395e5826c1a6371995709f7f6
7
+ data.tar.gz: 9ef9a6dd5774733c7badfb042a1c800ce52a25428f8b49f0f9e474d94eb92c2d91e6e2d19ec9cd46a471bf453f0806757efc7d78da82b1624153fd05cab15513
data/README.md CHANGED
@@ -32,6 +32,7 @@ gem 'simple_structured_logger'
32
32
  * https://github.com/asenchi/scrolls
33
33
  * https://github.com/stripe/chalk-log
34
34
  * https://github.com/nishidayuya/structured_logger
35
+ * https://github.com/rocketjob/semantic_logger
35
36
 
36
37
  ## Why is structured logging important?
37
38
 
@@ -45,7 +46,26 @@ PaperTrail and easily grab an audit trail for a specific context, i.e. `the_job=
45
46
 
46
47
  ## Usage
47
48
 
48
- TODO: Write usage instructions here
49
+ ```ruby
50
+ # config/initializers/logger.rb
51
+ if Rails.env.development? || Rails.env.test?
52
+ SimpleStructuredLogger::Writer.instance.logger = Rails.logger
53
+ end
54
+
55
+ # models/order.rb
56
+ class Order
57
+ include SimpleStructuredLogger
58
+
59
+ def initialize
60
+ log.reset_context!
61
+ log.default_tags[:global] = 'key'
62
+ end
63
+
64
+ def do_something
65
+ log.info 'simple structured logging', key: value, shopify_id: 123
66
+ end
67
+ end
68
+ ```
49
69
 
50
70
  ## Testing
51
71
 
@@ -39,7 +39,7 @@ module SimpleStructuredLogger
39
39
  class Writer
40
40
  include Singleton
41
41
 
42
- attr_reader :default_tags, :logger
42
+ attr_accessor :default_tags, :logger
43
43
 
44
44
  def initialize
45
45
  @logger = ::Logger.new(STDOUT)
@@ -73,11 +73,17 @@ module SimpleStructuredLogger
73
73
  end
74
74
 
75
75
  def warn(msg, opts={})
76
+ # TODO consider returning the generated log string with structured keys
77
+
76
78
  @logger.warn("#{msg}: #{stringify_tags(opts)}")
77
79
  end
78
80
 
79
81
  private
80
82
 
83
+ def generate_log(msg, opts)
84
+ #code
85
+ end
86
+
81
87
  def stringify_tags(additional_tags)
82
88
  additional_tags = additional_tags.dup
83
89
 
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "simple_structured_logger"
7
- spec.version = '0.1.3'
7
+ spec.version = '0.1.4'
8
8
  spec.authors = ["Michael Bianco"]
9
9
  spec.email = ["mike@cliffsidemedia.com"]
10
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_structured_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bianco
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-27 00:00:00.000000000 Z
11
+ date: 2017-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  version: '0'
87
87
  requirements: []
88
88
  rubyforge_project:
89
- rubygems_version: 2.6.4
89
+ rubygems_version: 2.5.1
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: Dead-simple structured logging in ruby with a dead-simple codebase.