yog 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/yog.rb +6 -3
  4. data/yog.gemspec +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db8903f2744b37ff04bc5dd36f44edb790b4878d176fd77a900ff5cef858680b
4
- data.tar.gz: 03a96abc9076220df30f0b55be41befb92eee172dc88d0224be0cdad8ce3f732
3
+ metadata.gz: c9a3d2332f241fe9669c87eb122afa62b618085a97764a095c28eca89652af8a
4
+ data.tar.gz: dcfa5e22597ab26cc93981e67ca358dba1dda6a5bc8a8980af9306a93e426979
5
5
  SHA512:
6
- metadata.gz: 46fbe2aa15a5fab09ba295a39fdb9673154a949dbaec4506322ee3d0b36a5b2b89ef337e594386f6c3dffe659c611f6319cc3662bf9caf7033faa716d738a825
7
- data.tar.gz: c18237cde2eaf11e02e8cc6ba567709464972e3730b974a29e01c1cdbfda6ed5e3001af87785d15cab5d5b56f39cf372c92555fa883fce0da318699b571ca569
6
+ metadata.gz: d4e2b87bfd01745ece125d06e30b1892b10dc8d10da48198ce2edd1c7703eba25d123eac3d3589031ee019eb487b93b97ec3665490c4a7c28726942b37918a32
7
+ data.tar.gz: 3df18c59fe3eaac77a87c89c92ccbf202b5a4ac02d4a85ee5294ad188df8abce2b4e74e17011070674bf1e5f8098fd406c0093164a37e2e45838874a1d8cfbc8
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yog (0.2.0)
4
+ yog (0.4.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/lib/yog.rb CHANGED
@@ -5,6 +5,9 @@ require "yog/logfmt"
5
5
  # Writes structured log lines.
6
6
  class Yog
7
7
 
8
+ # This context is included in every log line.
9
+ GLOBAL = {}
10
+
8
11
  # Get ready to do some yogging.
9
12
  def initialize(generator: Logfmt, output: $stdout, context: {})
10
13
  @context = context
@@ -37,7 +40,7 @@ class Yog
37
40
  prefix[:duration] = (Time.now - start) * 1000
38
41
  end
39
42
 
40
- combined = prefix.merge(@context).merge(fields)
43
+ combined = prefix.merge(GLOBAL).merge(@context).merge(fields)
41
44
  @output.puts(@generator.generate(combined))
42
45
 
43
46
  result
@@ -61,14 +64,14 @@ class Yog
61
64
  output: @output
62
65
  end
63
66
 
64
- ### Helpers for the default log
67
+ ### Static helpers
65
68
 
66
69
  # The log for Yog(), Yog.set(), and Yog.with().
67
70
  def self.default
68
71
  logs.first
69
72
  end
70
73
 
71
- # A stack of receivers with the default log first.
74
+ # A stack of thread-local receivers, current log first.
72
75
  def self.logs
73
76
  Thread.current[:logs] ||= [new]
74
77
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "yog"
3
- spec.version = "0.3.0"
3
+ spec.version = "0.4.0"
4
4
  spec.authors = ["John Barnette"]
5
5
  spec.email = ["john@jbarnette.com"]
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Barnette