hatchet 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Garry Shutler
1
+ Copyright (c) 2013 Garry Shutler
2
2
 
3
3
  MIT License
4
4
 
data/RELEASE.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Release notes
2
2
 
3
+ ## 0.2.7
4
+
5
+ * Hatchet can be marshalled to YAML safely (thanks to
6
+ [@gstark](https://github.com/gstark))
7
+
3
8
  ## 0.2.6
4
9
 
5
10
  * Log messages can be objects deferring to `to_s` (thanks to
data/lib/hatchet.rb CHANGED
@@ -173,6 +173,13 @@ module Hatchet
173
173
  klass.extend Hatchet
174
174
  end
175
175
 
176
+ # Internal: Definition to avoid the cache variable from being persisted when
177
+ # an instance including Hatchet is marshalled into YAML.
178
+ #
179
+ def to_yaml_properties
180
+ super - [:@_hatchet_logger]
181
+ end
182
+
176
183
  end
177
184
 
178
185
  # If we are running in a Rails environment include the Hatchet::Railtie class.
@@ -75,7 +75,6 @@ module Hatchet
75
75
  def initialize(host, configuration, ndc)
76
76
  @context = host_name(host)
77
77
  @configuration = configuration
78
- @appenders = configuration.appenders
79
78
  @ndc = ndc
80
79
  end
81
80
 
@@ -350,6 +349,13 @@ module Hatchet
350
349
  nil
351
350
  end
352
351
 
352
+ # Internal: Specifies the instance variables to be serialized when
353
+ # converting the logger to YAML.
354
+ #
355
+ def to_yaml_properties
356
+ [:@context]
357
+ end
358
+
353
359
  private
354
360
 
355
361
  # Private: Adds a message to each appender at the specified level.
@@ -377,9 +383,14 @@ module Hatchet
377
383
  def add_to_appenders(level, message, error, &block)
378
384
  return unless message or block
379
385
 
386
+ # Ensure configuration and context set - can be lost by marshalling and
387
+ # unmarshalling the logger.
388
+ @configuration ||= Hatchet.configuration
389
+ @ndc ||= Hatchet::NestedDiagnosticContext.current
390
+
380
391
  msg = Message.new(ndc: @ndc.context.clone, message: message, error: error, &block)
381
392
 
382
- @appenders.each do |appender|
393
+ @configuration.appenders.each do |appender|
383
394
  if appender.enabled?(level, @context)
384
395
  begin
385
396
  appender.add(level, @context, msg)
@@ -407,7 +418,7 @@ module Hatchet
407
418
  # Writes messages to STDOUT if any appender fails to complete the check.
408
419
  #
409
420
  def enabled?(level)
410
- @appenders.any? do |appender|
421
+ @configuration.appenders.any? do |appender|
411
422
  begin
412
423
  appender.enabled? level, @context
413
424
  rescue => e
@@ -4,6 +4,6 @@ module Hatchet
4
4
 
5
5
  # Public: The version of Hatchet.
6
6
  #
7
- VERSION = '0.2.6'
7
+ VERSION = '0.2.7'
8
8
 
9
9
  end
metadata CHANGED
@@ -1,24 +1,28 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: hatchet
3
- version: !ruby/object:Gem::Version
4
- version: 0.2.6
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.2.7
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Garry Shutler
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-08 00:00:00.000000000 Z
12
+
13
+ date: 2013-09-12 00:00:00 Z
13
14
  dependencies: []
14
- description: Logging library that provides the ability to add class/module specific
15
- filters
16
- email:
15
+
16
+ description: Logging library that provides the ability to add class/module specific filters
17
+ email:
17
18
  - garry@robustsoftware.co.uk
18
19
  executables: []
20
+
19
21
  extensions: []
22
+
20
23
  extra_rdoc_files: []
21
- files:
24
+
25
+ files:
22
26
  - lib/hatchet/backtrace_formatter.rb
23
27
  - lib/hatchet/configuration.rb
24
28
  - lib/hatchet/delegating_formatter.rb
@@ -55,36 +59,39 @@ files:
55
59
  - README.md
56
60
  - RELEASE.md
57
61
  homepage: http://gshutler.github.com/hatchet/
58
- licenses: []
62
+ licenses:
63
+ - MIT
59
64
  post_install_message:
60
65
  rdoc_options: []
61
- require_paths:
66
+
67
+ require_paths:
62
68
  - lib
63
- required_ruby_version: !ruby/object:Gem::Requirement
69
+ required_ruby_version: !ruby/object:Gem::Requirement
64
70
  none: false
65
- requirements:
66
- - - ! '>='
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- segments:
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 2082172114613149451
75
+ segments:
70
76
  - 0
71
- hash: -2691813738806144431
72
- required_rubygems_version: !ruby/object:Gem::Requirement
77
+ version: "0"
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
79
  none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- segments:
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ hash: 2082172114613149451
84
+ segments:
79
85
  - 0
80
- hash: -2691813738806144431
86
+ version: "0"
81
87
  requirements: []
88
+
82
89
  rubyforge_project:
83
- rubygems_version: 1.8.25
90
+ rubygems_version: 1.8.24
84
91
  signing_key:
85
92
  specification_version: 3
86
93
  summary: Logging library that provides the ability to add class/module specific filters
87
- test_files:
94
+ test_files:
88
95
  - spec/configuration_spec.rb
89
96
  - spec/helpers/disabled_appender.rb
90
97
  - spec/helpers/failing_appender.rb