logatron 0.3.0 → 0.5.0

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: 9002759f4e430ddf783db14bbce434bde72ab52f
4
- data.tar.gz: 102280caab2ab630b72fa8f598275837f747256e
3
+ metadata.gz: d82d9b137853b2f0a52d7447bc693ed95f7de453
4
+ data.tar.gz: edfa18b77c0597e760296db646e9264e0386ca90
5
5
  SHA512:
6
- metadata.gz: d03c652f11b3da3093960714a9fe0a150f585923f610a14860c970e2680c8195ddcf9be140b07db9a73d1687c11f6b5a5e414ea713d5947e553776918f929a81
7
- data.tar.gz: 1bade1783726b10243c369b2245ec898d8313c9612af05a475fa0941b7636f4282ee2fef107cbeda04a93de072428aef32b0b67a3d2725b08e21f19f3975843c
6
+ metadata.gz: 7f04b6bb0d83561c3fc8c820bc2c0033b3071a7a61e083ffba1e6b3017678f2ea7bb6496638607dad54809e708360f5601b087fc22b65661b84fdd1859f9759c
7
+ data.tar.gz: 2c2d9991e3dffd995bd3733b3b01ffa6352738e27406a58dbfc5f4b7059a55a1c5af067b5ee2df302ecbb1d0976e007330f214b3dedd5c814a855f03f5bf37de
data/CHANGES.md ADDED
@@ -0,0 +1,114 @@
1
+ ## [0.5.0](https://github.com/indigobio/logatron/compare/v0.4.1...indigobio:v0.5.0) (2016-06-02)
2
+
3
+ - Update version to 0.5.0
4
+ ([be53842](https://github.com/indigobio/logatron/commit/be53842df2da6479b23ca019d34bdc96035e7915))
5
+ - Added changelog and build.yml
6
+ ([2ee67c1](https://github.com/indigobio/logatron/commit/2ee67c100a012f7ba9c8ee9bd842603d9f108c84))
7
+
8
+
9
+ ## [0.4.1](https://github.com/indigobio/logatron/compare/v0.4.0...indigobio:v0.4.1) (2016-05-02)
10
+
11
+ [AR-1794](https://indigobio.atlassian.net/browse/AR-1794) - Add 'app' as a key to the logging format in logatron<br/>
12
+
13
+ - [AR-1794](https://indigobio.atlassian.net/browse/AR-1794) added pid
14
+ ([5db2f8b](https://github.com/indigobio/logatron/commit/5db2f8b0c852e6a5b183bf75aa68ae9983e485ea))
15
+ - [AR-1794](https://indigobio.atlassian.net/browse/AR-1794) fixed new lines
16
+ ([c640e80](https://github.com/indigobio/logatron/commit/c640e80d59de6723ff235937480b03e0b8127887))
17
+ - [AR-1794](https://indigobio.atlassian.net/browse/AR-1794) needed railtie formatter
18
+ ([756dd69](https://github.com/indigobio/logatron/commit/756dd69b7306ade50877923b9711d4d5b218a9c8))
19
+
20
+
21
+ ## [0.4.0](https://github.com/indigobio/logatron/compare/v0.3.0...indigobio:v0.4.0) (2016-05-02)
22
+
23
+ [AR-1794](https://indigobio.atlassian.net/browse/AR-1794) - Add 'app' as a key to the logging format in logatron<br/>
24
+
25
+ - Formatting with rubocop
26
+ ([bc198d7](https://github.com/indigobio/logatron/commit/bc198d73e5e32e27761421fbd1a8e1ae91eba0b6))
27
+ - [AR-1794](https://indigobio.atlassian.net/browse/AR-1794) Added app_id, default it to 'N/A', can be set in logatron's configuration
28
+ ([4b79949](https://github.com/indigobio/logatron/commit/4b7994941f9b89cc6c82b673fca2ae2385487312))
29
+
30
+
31
+ ## [0.3.0](https://github.com/indigobio/logatron/compare/v0.2.6...indigobio:v0.3.0) (2016-04-20)
32
+
33
+ [AR-1708](https://indigobio.atlassian.net/browse/AR-1708) - Add "invalid_use" for severity options to Logatron<br/>
34
+
35
+ - Turn off debugging in update_version.sh
36
+ ([52b7c89](https://github.com/indigobio/logatron/commit/52b7c89227006886cb1227343af4a735aba4f7d1))
37
+ - Remove dead code in update_version.sh; turn on debugging
38
+ ([bbd7773](https://github.com/indigobio/logatron/commit/bbd77735cda5d1f92b2399461eaca8040dbf53cb))
39
+ - [AR-1708](https://indigobio.atlassian.net/browse/AR-1708) Improved method for logging exceptions
40
+ ([97f6a2e](https://github.com/indigobio/logatron/commit/97f6a2e46f4c0837a64cda4afe94310c8a7929f7))
41
+
42
+
43
+ ## [0.2.6](https://github.com/indigobio/logatron/compare/v0.2.5...indigobio:v0.2.6) (2016-04-15)
44
+
45
+ [AR-1708](https://indigobio.atlassian.net/browse/AR-1708) - Add "invalid_use" for severity options to Logatron<br/>
46
+
47
+ - [AR-1708](https://indigobio.atlassian.net/browse/AR-1708) - Flipped conditional in my review, didn't run tests. Failed us all
48
+ ([e022ed3](https://github.com/indigobio/logatron/commit/e022ed38a9b9375fd491f6da0fef13a2d85f4cc1))
49
+ - [AR-1708](https://indigobio.atlassian.net/browse/AR-1708) - Robust filtering of loggable levels, adding comments
50
+ ([88b6a43](https://github.com/indigobio/logatron/commit/88b6a43e82f931da089048fc4738927f8a291ca3))
51
+ - [AR-1708](https://indigobio.atlassian.net/browse/AR-1708) - Adding invalid_use to tests, loggers
52
+ ([32f6eeb](https://github.com/indigobio/logatron/commit/32f6eebf7a2d5ad20074dc56a68300e749e06b0f))
53
+
54
+
55
+ ## [0.2.5](https://github.com/indigobio/logatron/compare/v0.2.4...indigobio:v0.2.5) (2016-04-13)
56
+
57
+ [AR-1708](https://indigobio.atlassian.net/browse/AR-1708) - Add "invalid_use" for severity options to Logatron<br/>
58
+
59
+
60
+ ## [0.2.4](https://github.com/indigobio/logatron/compare/v0.2.3...indigobio:v0.2.4) (2016-02-03)
61
+
62
+
63
+ ## [0.2.3](https://github.com/indigobio/logatron/compare/v0.2.2...indigobio:v0.2.3) (2016-01-06)
64
+
65
+
66
+ ## [0.2.2](https://github.com/indigobio/logatron/compare/v0.2.1...indigobio:v0.2.2) (2016-01-04)
67
+
68
+
69
+ ## [0.2.1](https://github.com/indigobio/logatron/compare/v0.2.0...indigobio:v0.2.1) (2015-12-18)
70
+
71
+
72
+ ## [0.2.0](https://github.com/indigobio/logatron/compare/v0.1.11...indigobio:v0.2.0) (2015-12-16)
73
+
74
+
75
+ ## [0.1.11](https://github.com/indigobio/logatron/compare/v0.1.10...indigobio:v0.1.11) (2015-12-16)
76
+
77
+
78
+ ## [0.1.10](https://github.com/indigobio/logatron/compare/v0.1.9...indigobio:v0.1.10) (2015-12-16)
79
+
80
+
81
+ ## [0.1.9](https://github.com/indigobio/logatron/compare/v0.1.8...indigobio:v0.1.9) (2015-12-16)
82
+
83
+
84
+ ## [0.1.8](https://github.com/indigobio/logatron/compare/v0.1.7...indigobio:v0.1.8) (2015-12-16)
85
+
86
+
87
+ ## [0.1.7](https://github.com/indigobio/logatron/compare/v0.1.6...indigobio:v0.1.7) (2015-12-16)
88
+
89
+
90
+ ## [0.1.6](https://github.com/indigobio/logatron/compare/v0.1.5...indigobio:v0.1.6) (2015-12-16)
91
+
92
+
93
+ ## [0.1.5](https://github.com/indigobio/logatron/compare/v0.1.4...indigobio:v0.1.5) (2015-12-16)
94
+
95
+
96
+ ## [0.1.4](https://github.com/indigobio/logatron/compare/v0.1.3...indigobio:v0.1.4) (2015-12-03)
97
+
98
+
99
+ ## [0.1.3](https://github.com/indigobio/logatron/compare/v0.1.2...indigobio:v0.1.3) (2015-12-03)
100
+
101
+ - Give lograge logatron as its logger. Alias log and add for Syslog::Logger since all other "Logger" classes in ruby do this
102
+ ([d3c1e18](https://github.com/indigobio/logatron/commit/d3c1e184bb92c61ed8ebcdc0b14c9de09cb8c92d))
103
+
104
+
105
+ ## [0.1.2](https://github.com/indigobio/logatron/compare/v0.1.1...indigobio:v0.1.2) (2015-11-19)
106
+
107
+ - Removed hard dependency on logatron to avoid pulling a bunch of rails gems into every project that uses logatron
108
+ ([25daaab](https://github.com/indigobio/logatron/commit/25daaab6d9233afa258f3d8524926e6db0f34166))
109
+
110
+
111
+ ## [0.1.1](https://github.com/indigobio/logatron/compare/v0.1.0...indigobio:v0.1.1) (2015-11-13)
112
+
113
+
114
+ ## [0.1.0](https://github.com/indigobio/logatron/compare/b6d85beb93a2c9f3c18052f52ba676613c6bdaed...indigobio:v0.1.0) (2015-11-13)
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- logatron (0.3.0)
4
+ logatron (0.4.1)
5
5
  activesupport (~> 4.2, >= 4.2.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (4.2.5.1)
10
+ activesupport (4.2.6)
11
11
  i18n (~> 0.7)
12
12
  json (~> 1.7, >= 1.7.7)
13
13
  minitest (~> 5.1)
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "logatron/logatron"
3
+ require 'bundler/setup'
4
+ require 'logatron/logatron'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "logatron/logatron"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start
data/build.yml ADDED
@@ -0,0 +1,2 @@
1
+ changelog:
2
+ show_commits: true
@@ -1,8 +1,7 @@
1
1
  module Logatron
2
2
  class BasicFormatter
3
- def call(severity, time, progname, msg)
4
- msg
3
+ def call(_severity, _time, _progname, msg)
4
+ msg + "\n"
5
5
  end
6
6
  end
7
7
  end
8
-
@@ -57,4 +57,3 @@ module Logatron
57
57
  end
58
58
  end
59
59
  end
60
-
@@ -9,7 +9,7 @@ module Logatron
9
9
 
10
10
  def initialize(logger)
11
11
  @logger = logger
12
- @logs = Hash[Logatron::SEVERITY_MAP.keys.map{|key| [key, []]}]
12
+ @logs = Hash[Logatron::SEVERITY_MAP.keys.map { |key| [key, []] }]
13
13
  end
14
14
 
15
15
  def info(msg)
@@ -40,7 +40,7 @@ module Logatron
40
40
  write(format_log(msg: msg, severity: FATAL), FATAL)
41
41
  end
42
42
 
43
- def write(string, severity=INFO)
43
+ def write(string, severity = INFO)
44
44
  @logs[severity].push string
45
45
  end
46
46
 
@@ -16,23 +16,23 @@ module Logatron
16
16
  end
17
17
 
18
18
  def self.configure
19
- self.configuration
19
+ configuration
20
20
  yield(configuration)
21
21
  end
22
22
 
23
23
  class Configuration
24
- attr_accessor :logger, :host, :level, :transformer
24
+ attr_accessor :logger, :host, :level, :transformer, :app_id
25
25
  attr_reader :loggable_levels, :backtrace_cleaner
26
26
 
27
27
  def initialize
28
28
  @logger = Logger.new(STDOUT)
29
-
30
- @transformer = proc {|x| x.to_json}
29
+ @app_id = 'N/A'
30
+ @transformer = proc { |x| x.to_json }
31
31
  @host = `hostname`.chomp
32
32
  @level = INFO
33
33
  level_threshold = SEVERITY_MAP[@level]
34
34
  levels = Logatron::SEVERITY_MAP.keys
35
- @loggable_levels = levels.select{|level| SEVERITY_MAP[level] >= level_threshold}
35
+ @loggable_levels = levels.select { |level| SEVERITY_MAP[level] >= level_threshold }
36
36
  bc = ActiveSupport::BacktraceCleaner.new
37
37
  bc.add_filter { |line| line.gsub(Rails.root.to_s, '') } if defined? Rails
38
38
  bc.add_silencer { |line| line =~ /gems/ }
@@ -40,7 +40,7 @@ module Logatron
40
40
  end
41
41
 
42
42
  def logger=(logger)
43
- level = @logger.level
43
+ level = @logger.level
44
44
  @logger = logger
45
45
  @logger.level = level
46
46
  @logger.formatter = Logatron::BasicFormatter.new
@@ -19,13 +19,13 @@ module Logatron
19
19
  # UNKNOWN = 5
20
20
  # Note that the Logatron Severities will be put into
21
21
  # the logs (severity => INVALID_USE), for filtering purposes
22
- SEVERITY_MAP = {
23
- Logatron::DEBUG => 0,
24
- Logatron::INFO => 1,
25
- Logatron::INVALID_USE => 1,
26
- Logatron::WARN => 2,
27
- Logatron::ERROR => 3,
28
- Logatron::CRITICAL => 4,
29
- Logatron::FATAL => 5
30
- }
22
+ SEVERITY_MAP = {
23
+ Logatron::DEBUG => 0,
24
+ Logatron::INFO => 1,
25
+ Logatron::INVALID_USE => 1,
26
+ Logatron::WARN => 2,
27
+ Logatron::ERROR => 3,
28
+ Logatron::CRITICAL => 4,
29
+ Logatron::FATAL => 5
30
+ }.freeze
31
31
  end
@@ -16,15 +16,16 @@ module Logatron
16
16
  @log ||= Logatron::BasicLogger.new
17
17
  end
18
18
 
19
- def log_exception(e, severity, additional_info={})
19
+ def log_exception(e, severity, additional_info = {})
20
20
  # 'additional_info' can be a flat hash or anything with '#to_s'
21
21
  message = exception_message(e, additional_info)
22
22
  logger.send(severity.downcase, message)
23
23
  end
24
24
 
25
25
  def level=(level)
26
- logger.level=level
26
+ logger.level = level
27
27
  end
28
+
28
29
  def error(msg)
29
30
  logger.error(msg)
30
31
  end
@@ -51,7 +52,7 @@ module Logatron
51
52
 
52
53
  def http_headers
53
54
  {
54
- 'X-Ascent-Log-Id' => msg_id
55
+ 'X-Ascent-Log-Id' => msg_id
55
56
  }
56
57
  end
57
58
 
@@ -78,7 +79,7 @@ module Logatron
78
79
  private
79
80
 
80
81
  def exception_message(e, additional)
81
- info = additional.is_a?(Hash) ? additional.map { |(k, v)| "#{k}=>#{v}"}.join(', ') : additional
82
+ info = additional.is_a?(Hash) ? additional.map { |(k, v)| "#{k}=>#{v}" }.join(', ') : additional
82
83
  info_msg = info.nil? || info.empty? ? '' : "; MORE_INFO( #{info} )"
83
84
  backtrace = configuration.backtrace_cleaner.clean(e.backtrace).join(' -> ')
84
85
  "#{e.class} #{e.message}#{info_msg} -> #{backtrace}"
@@ -8,6 +8,8 @@ module Logatron
8
8
 
9
9
  def format_log(msg: '-', status: '-', duration: '-', request: '-', inputs: '-', severity: '-')
10
10
  Logatron.configuration.transformer.call(
11
+ pid: Process.pid,
12
+ app_id: Logatron.configuration.app_id,
11
13
  timestamp: Time.now.iso8601,
12
14
  severity: severity,
13
15
  host: Logatron.configuration.host,
@@ -17,10 +19,7 @@ module Logatron
17
19
  duration: duration,
18
20
  request: request,
19
21
  source: inputs,
20
- body: msg) + "\n"
22
+ body: msg)
21
23
  end
22
24
  end
23
25
  end
24
-
25
-
26
-
@@ -38,7 +38,7 @@ module Logatron
38
38
  config.lograge.enabled = true
39
39
  config.lograge.formatter = Lograge::Formatters::Json.new
40
40
  config.lograge.custom_options = lambda do |event|
41
- { source: event.payload[:ip], severity: Logatron::INFO, site: Logatron.site, timestamp: Time.now.iso8601, host: Logatron.configuration.host, id: Logatron.msg_id }
41
+ { source: event.payload[:ip], severity: Logatron::INFO, site: Logatron.site, timestamp: Time.now.iso8601, host: Logatron.configuration.host, pid: Process.pid, app_id: Logatron.configuration.app_id, id: Logatron.msg_id }
42
42
  end
43
43
  end
44
44
  end
@@ -1,3 +1,3 @@
1
1
  module Logatron
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.4'.freeze
3
3
  end
data/logatron.gemspec CHANGED
@@ -5,12 +5,12 @@ require 'logatron/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'logatron'
8
- spec.version = '0.3.0'
8
+ spec.version = '0.5.0'
9
9
  spec.authors = ['Justin Grimes']
10
10
  spec.email = ['justin.mgrimes@gmail.com']
11
11
 
12
- spec.summary = %q{Logging for ascent }
13
- spec.description = %q{Logging for ascent }
12
+ spec.summary = 'Logging for ascent '
13
+ spec.description = 'Logging for ascent '
14
14
  spec.homepage = 'http://github.com/indigobio/logatron'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logatron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Grimes
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-20 00:00:00.000000000 Z
11
+ date: 2016-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -95,6 +95,7 @@ extra_rdoc_files: []
95
95
  files:
96
96
  - ".gitignore"
97
97
  - ".ruby-version"
98
+ - CHANGES.md
98
99
  - CODE_OF_CONDUCT.md
99
100
  - Gemfile
100
101
  - Gemfile.lock
@@ -102,6 +103,7 @@ files:
102
103
  - Rakefile
103
104
  - bin/console
104
105
  - bin/setup
106
+ - build.yml
105
107
  - lib/logatron/basic_formatter.rb
106
108
  - lib/logatron/basic_logger.rb
107
109
  - lib/logatron/basic_scoped_logger.rb
@@ -138,3 +140,4 @@ signing_key:
138
140
  specification_version: 4
139
141
  summary: Logging for ascent
140
142
  test_files: []
143
+ has_rdoc: