journald-logger 2.0.3 → 2.0.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
- SHA1:
3
- metadata.gz: f5f9e90a388afc73c867bc6f80a0d7b9084c2319
4
- data.tar.gz: eb0cfcc94e6a094df170ad6b9f629983b1c39220
2
+ SHA256:
3
+ metadata.gz: 79ce8cdc578a85397fcf5b32cfc6ffff1482667b07d13c94a76a8acb6b11fba3
4
+ data.tar.gz: f7f2aa5432b567bd1c096633caa7ee556295c7fed54252bbc9e4b19b661c2f62
5
5
  SHA512:
6
- metadata.gz: b86b9f92d02fc7609a288fdb46d177801e07ea8c310f2f9e665f5d52a9fe762db099d11205701b50cec9dcd0c98a2959bbbf95b98f5de200dd838951e2cc01ab
7
- data.tar.gz: 35f17768df4f6ad8d86db44945eb6900ff4e2562fdeef90651bd30a6322d4ea4ebcd1455273c4de720a47084b138ae247953cff450fd7d6d1deee72525a100d5
6
+ metadata.gz: 36efaf90a438c87cbe074ba9714a526ae82b272183561689729dddfae73915dae2ff5b26da796ae80941ee152d4d77795b1cb8a45f0bd502f2edb63ba7e04eeb
7
+ data.tar.gz: dc77258eae320c96ea4f8839863dcd27f2c8e5813ed9d5cef71d7fb406bcb5bb94e98ef6d6f5ead25878dd6af7b18449008564733e1cc7245c135b5240540ab8
@@ -0,0 +1,14 @@
1
+ # test with minimum and current and previous version of ruby; try default version of rbx
2
+
3
+ language: ruby
4
+ os:
5
+ - xenial # we cannot actually test until xenial is added to Travis
6
+ rvm:
7
+ - '2.0.0'
8
+ - '2.1.0'
9
+ - '2.2.4'
10
+ - '2.3.0'
11
+ - rbx
12
+ script:
13
+ - bundle exec rake compile
14
+ - bundle exec rspec
@@ -0,0 +1,63 @@
1
+ # Changelog
2
+
3
+ ## v2.0.4
4
+
5
+ *October 9, 2018*
6
+
7
+ * Return support for ruby 2.0.0
8
+
9
+ ## v2.0.3
10
+
11
+ *March 14, 2016*
12
+
13
+ - tag() now returns value returned from yield
14
+ - add silence_logger() alias for silence()
15
+
16
+ ## v2.0.2
17
+
18
+ *August 28, 2015*
19
+
20
+ * [FIX] Fix silence implementation: should pass `self` to the block and return block result
21
+
22
+ ## v2.0.1
23
+
24
+ *August 28, 2015*
25
+
26
+ * [FIX] Implement `Logger.silence` required by activerectord-session_store
27
+
28
+ ## v2.0.0
29
+
30
+ *August 24, 2015*
31
+
32
+ - Gem now depends on Ruby 2.1
33
+ - Tag syntax changed to hash style _(this breaks all 1.x tag calls)_ and accepts multiple tags at once
34
+ - Tagging with block now restores previous tag values
35
+ - Removed `TracerLogger` alias for `TraceLogger`
36
+
37
+ ## v1.1.1
38
+
39
+ *December 18, 2014*
40
+
41
+ - fix constructor incompatibility between 1.0 and 1.1
42
+ - fix failure in exception() when backtrace is nil
43
+
44
+ ## v1.1.0
45
+
46
+ *December 17, 2014*
47
+
48
+ - Add minimum reporting level logic
49
+ - Exception default level changed to LOG_ERR
50
+
51
+ ## v1.0.1
52
+
53
+ *December 11, 2014*
54
+
55
+ - TracerLogger rewritten no to use method_missing. This also fixes `send()` method.
56
+ Renamed to TraceLogger with backwards compatibility
57
+ - Some refactoring
58
+
59
+ ## v1.0.0
60
+
61
+ *November 20, 2014*
62
+
63
+ Initial stable release
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2015 Anton Smirnov
1
+ Copyright (c) 2014-2016 Anton Smirnov
2
2
 
3
3
  MIT License
4
4
 
@@ -6,20 +6,22 @@ Gem::Specification.new do |spec|
6
6
  spec.name = 'journald-logger'
7
7
  spec.version = Journald::Logger::VERSION
8
8
  spec.authors = ['Anton Smirnov']
9
- spec.email = ['sandfox@sandfox.im']
9
+ spec.email = ['sandfox@sandfox.me']
10
10
  spec.summary = %q{systemd-journal native logger}
11
11
  # spec.description = %q{TODO: Write a longer description. Optional.}
12
- spec.homepage = 'https://github.com/sandfox-im/journald-logger'
12
+ spec.homepage = 'https://github.com/sandfoxme/journald-logger'
13
13
  spec.license = 'MIT'
14
14
 
15
15
  spec.files = `git ls-files -z`.split("\x0")
16
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
17
  spec.require_paths = ['lib']
18
18
 
19
- spec.required_ruby_version = '>= 2.1.0'
19
+ spec.required_ruby_version = '>= 2.0.0'
20
20
 
21
21
  spec.add_runtime_dependency 'journald-native', '~> 1.0'
22
22
 
23
23
  spec.add_development_dependency 'bundler', '~> 1.6'
24
24
  spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'rspec', '~> 3.4'
26
+ spec.add_development_dependency 'simplecov'
25
27
  end
@@ -9,8 +9,11 @@ module Journald
9
9
  private
10
10
 
11
11
  def real_exception(e, priority, is_cause)
12
- # get backtrace if present
13
- bt = e.backtrace_locations &&
12
+ # for Ruby 2.1 get cause if present
13
+ cause = if e.respond_to? :cause; e.cause; end
14
+ # for Ruby 2.1 get backtrace if present
15
+ bt = e.respond_to?(:backtrace_locations) &&
16
+ e.backtrace_locations &&
14
17
  e.backtrace_locations.length > 0
15
18
 
16
19
  tag_trace_location(e.backtrace_locations[0]) if bt
@@ -22,12 +25,12 @@ module Journald
22
25
  exception_class: e.class.name,
23
26
  exception_message: e.message,
24
27
  backtrace: bt ? e.backtrace.join("\n"): nil,
25
- cause: e.cause ? e.cause.inspect : nil,
28
+ cause: cause ? cause.inspect : nil,
26
29
  )
27
30
 
28
31
  untag_trace_location if bt
29
32
 
30
- real_exception(e.cause, priority, true) if e.cause
33
+ real_exception(cause, priority, true) if cause
31
34
  end
32
35
  end
33
36
  end
@@ -1,5 +1,5 @@
1
1
  module Journald
2
2
  class Logger
3
- VERSION = '2.0.3'
3
+ VERSION = '2.0.4'
4
4
  end
5
5
  end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Journald::Logger do
4
+ describe 'acts as logger' do
5
+ before(:each) do
6
+ allow(Journald::Native).to receive(:send).and_return(0)
7
+ @logger = Journald::Logger.new('rspec journald-logger', Journald::LOG_DEBUG)
8
+ end
9
+
10
+ it 'logs things as logger' do
11
+ # todo: expects
12
+ @logger.warn 'test warn'
13
+ end
14
+
15
+ it 'logs things as syslog' do
16
+ # todo: expects
17
+ @logger.log_warning 'test log_warning'
18
+ end
19
+
20
+ it 'adds tags' do
21
+ @logger.tag(tag1: 'value1')
22
+ @logger.tag(tag2: 'value2')
23
+
24
+ expect(@logger.tag_value(:tag1)).to eq('value1')
25
+
26
+ @logger.tag(tag1: 'in-block-value') do
27
+ expect(@logger.tag_value(:tag1)).to eq('in-block-value')
28
+ end
29
+
30
+ expect(@logger.tag_value(:tag1)).to eq('value1') # expect old value to be restored
31
+ end
32
+
33
+ it 'logs exceptions' do
34
+ # todo: expects
35
+ begin
36
+ raise 'logs exception'
37
+ rescue => e
38
+ @logger.exception e
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,4 @@
1
+ require 'simplecov'
2
+ SimpleCov.start
3
+
4
+ require_relative '../lib/journald/logger'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: journald-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Smirnov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-14 00:00:00.000000000 Z
11
+ date: 2018-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: journald-native
@@ -52,14 +52,44 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.4'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  description:
56
84
  email:
57
- - sandfox@sandfox.im
85
+ - sandfox@sandfox.me
58
86
  executables: []
59
87
  extensions: []
60
88
  extra_rdoc_files: []
61
89
  files:
62
90
  - ".gitignore"
91
+ - ".travis.yml"
92
+ - CHANGELOG.md
63
93
  - Gemfile
64
94
  - LICENSE.txt
65
95
  - README.md
@@ -72,7 +102,9 @@ files:
72
102
  - lib/journald/modules/loggable.rb
73
103
  - lib/journald/modules/sysloggable.rb
74
104
  - lib/journald/modules/version.rb
75
- homepage: https://github.com/sandfox-im/journald-logger
105
+ - spec/journald_logger_spec.rb
106
+ - spec/spec_helper.rb
107
+ homepage: https://github.com/sandfoxme/journald-logger
76
108
  licenses:
77
109
  - MIT
78
110
  metadata: {}
@@ -84,7 +116,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
116
  requirements:
85
117
  - - ">="
86
118
  - !ruby/object:Gem::Version
87
- version: 2.1.0
119
+ version: 2.0.0
88
120
  required_rubygems_version: !ruby/object:Gem::Requirement
89
121
  requirements:
90
122
  - - ">="
@@ -92,8 +124,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
124
  version: '0'
93
125
  requirements: []
94
126
  rubyforge_project:
95
- rubygems_version: 2.4.6
127
+ rubygems_version: 2.7.6
96
128
  signing_key:
97
129
  specification_version: 4
98
130
  summary: systemd-journal native logger
99
- test_files: []
131
+ test_files:
132
+ - spec/journald_logger_spec.rb
133
+ - spec/spec_helper.rb