logatron 0.2.3 → 0.2.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: 0d8582df4105d409dd84011a9f16005df5937bae
4
- data.tar.gz: 26f096f6ca1c160966591a194f735a73ae5c6af5
3
+ metadata.gz: d9fed786239c01a5346c6e93e7c2656bf5ae4616
4
+ data.tar.gz: eb0340cb109e2ae9ad88e401530d827b47961269
5
5
  SHA512:
6
- metadata.gz: 4cbe95c5deaa999b5dda7b9432ca8d676c1673e4e32fd9dcf3d7234bec6da5ffe9ced02511c728f86d4c39c472710e96d567f636c133e4ada9acc380eeb82ae5
7
- data.tar.gz: 3fde12f5cc5132670640f21d45332ea2f6e83bfdca682d292deb384bb895ffa5e7fb541d7364a9dfead28d00d1ee243bc43002ef8d2a6295c6571fb505a4be4a
6
+ metadata.gz: 0d65d820bfbfa99b60884afdad5eb8650aa96b4daa0cef62fe7d5a37e4db398bf29a6990d9026a2b6208c9bcf5c56758f21811b1fe512277a7f7a814c3c72896
7
+ data.tar.gz: 7b0c58a3d2f17315d980c5e72999fcd763ab964eadc56abb70245a14443fa91284b5572fcef4f445522c1f2039d4ae473d0a33c7d689559434a4050b2f0644e2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- logatron (0.2.3)
4
+ logatron (0.2.4)
5
5
  activesupport (~> 4.2, >= 4.2.1)
6
6
 
7
7
  GEM
@@ -1,4 +1,4 @@
1
- require 'syslog/logger'
1
+ require 'logger'
2
2
  require 'logatron/const'
3
3
  require 'logatron/basic_formatter'
4
4
  require 'active_support/backtrace_cleaner'
@@ -15,7 +15,6 @@ module Logatron
15
15
  end
16
16
  end
17
17
 
18
-
19
18
  def self.configure
20
19
  self.configuration
21
20
  yield(configuration)
@@ -26,7 +25,7 @@ module Logatron
26
25
  attr_reader :loggable_levels, :backtrace_cleaner
27
26
 
28
27
  def initialize
29
- @logger = Syslog::Logger.new('ascent')
28
+ @logger = Logger.new(STDOUT)
30
29
 
31
30
  @transformer = proc {|x| x.to_json}
32
31
  @host = `hostname`.chomp
@@ -45,7 +44,7 @@ module Logatron
45
44
  end
46
45
 
47
46
  def logger=(logger)
48
- level = @logger.level
47
+ level = @logger.level
49
48
  @logger = logger
50
49
  @logger.level = level
51
50
  @logger.formatter = Logatron::BasicFormatter.new
@@ -74,5 +74,3 @@ module Logatron
74
74
  end
75
75
  end
76
76
  end
77
-
78
- require 'logatron/railtie' if defined?(Rails)
@@ -1,8 +1,8 @@
1
1
  require 'lograge' # if this is an error for you, add 'lograge' to your bundle (left out of this gem's gemspec to keep dependencies down)
2
-
2
+ require 'syslog/logger'
3
3
  module Syslog
4
4
  class Logger
5
- alias_method :log, :add
5
+ alias log add
6
6
  end
7
7
  end
8
8
 
@@ -11,11 +11,12 @@ module Logatron
11
11
  def initialize(app)
12
12
  @app = app
13
13
  end
14
+
14
15
  def call(env)
15
16
  request = ActionDispatch::Request.new(env)
16
17
  if request.headers['X-Ascent-Log-Id']
17
18
  Logatron.msg_id = request.headers['X-Ascent-Log-Id']
18
- elsif env['rack.session'].nil? or env['rack.session']['warden.user.user.key'].nil?
19
+ elsif env['rack.session'].nil? || env['rack.session']['warden.user.user.key'].nil?
19
20
  Logatron.msg_id = SecureRandom.uuid + '-id-anonymous'
20
21
  else
21
22
  Logatron.msg_id = SecureRandom.uuid + '-id-' + env['rack.session']['warden.user.user.key'][0][0].to_s
@@ -25,24 +26,19 @@ module Logatron
25
26
  end
26
27
 
27
28
  class Railtie < Rails::Railtie
28
-
29
29
  initializer 'logatron.configure_rails_initialization' do |app|
30
-
31
30
  if defined?(Warden::Manager)
32
31
  app.middleware.insert_before(Warden::Manager, Logatron::Middleware)
33
32
  else
34
33
  app.middleware.use Logatron::Middleware
35
34
  end
36
-
37
35
  end
38
36
 
39
- config.lograge.logger = Logatron.configuration.logger
40
- config.lograge.enabled = true
41
- config.lograge.formatter = Lograge::Formatters::Json.new
42
- config.lograge.custom_options = lambda do |event|
43
- {:source => event.payload[:ip], :severity=> Logatron::INFO, :site => Logatron.site, :timestamp => Time.now.iso8601, :host => Logatron.configuration.host, :id => Logatron.msg_id}
44
- end
45
-
37
+ config.lograge.logger = Logatron.configuration.logger
38
+ config.lograge.enabled = true
39
+ config.lograge.formatter = Lograge::Formatters::Json.new
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 }
42
+ end
46
43
  end
47
-
48
44
  end
data/logatron.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'logatron/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'logatron'
8
- spec.version = '0.2.3'
8
+ spec.version = '0.2.4'
9
9
  spec.authors = ['Justin Grimes']
10
10
  spec.email = ['justin.mgrimes@gmail.com']
11
11
 
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.2.3
4
+ version: 0.2.4
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-01-06 00:00:00.000000000 Z
11
+ date: 2016-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport