synchrolog-ruby 0.1.6 → 0.1.7

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
  SHA256:
3
- metadata.gz: 2d7db7fe6b9f91d8797224509b550d6d443f00e3fdbe8e21e2721cc8f2ab6ccb
4
- data.tar.gz: b66ca841ec9f54a6d7cb7cf0cb7bae7dee256910865111e3fdcb83612c9af1f5
3
+ metadata.gz: 70201f605e786d4adb36a17f0edc6acb3626bb2c0f2251965ff30b7a4b27b05d
4
+ data.tar.gz: 399475c51cf255079818936f3edf9d048ad3632e01be7fc608a679342851c041
5
5
  SHA512:
6
- metadata.gz: bbde233f6b5e6acc54e14edc883b9c947b6aad4a6fe4d5bb318af106b685789f653353b7df84275af827137c06ad89596be825ab996e9021573495a648eb06c7
7
- data.tar.gz: 3ea0ed40a25355926955ac680f0c356e655720c7d88fe11c19c82f3909bcfa9af90132e7b95858ff1b9b0c16d7758405f26d6eb36ea02bc0c7e6a2043130522e
6
+ metadata.gz: 431029fa4c2f535359d8349f2b1f5658ed9c292d07233796c30514726cb197308928d31b7fe7dc944abbccbf896b235e3ea4de613b94d69fad81b0c0ca336f18
7
+ data.tar.gz: 440adf83cbd3d56fcd8fcdbb2d3e15f434701199c8475b54ed2a30102c94f5f1b8b0368af67028958f35c5f2d059d5d82b4256026dfa6381fa251f32f6944856
data/lib/synchrolog.rb CHANGED
@@ -5,31 +5,31 @@ require 'synchrolog/middleware'
5
5
 
6
6
  require 'active_support/logger'
7
7
  require 'active_support/tagged_logging'
8
-
8
+
9
9
  module Synchrolog
10
10
  class Client
11
11
  def initialize(api_key, opts={})
12
12
  @api_key = api_key
13
13
  @opts = opts
14
14
  end
15
-
15
+
16
16
  def logger
17
17
  @logger ||= initialize_logger
18
18
  end
19
-
19
+
20
20
  def exception_logger
21
21
  @exception_logger ||= initialize_exception_logger
22
22
  end
23
-
23
+
24
24
  private
25
-
25
+
26
26
  def initialize_logger
27
27
  client = Synchrolog::Logger.new(@api_key, @opts)
28
28
  logger = ActiveSupport::Logger.new(client)
29
29
  logger.formatter = SynchrologFormatter.new
30
30
  ActiveSupport::TaggedLogging.new(logger)
31
31
  end
32
-
32
+
33
33
  def initialize_exception_logger
34
34
  Synchrolog::ExceptionLogger.new(@api_key, @opts)
35
35
  end
@@ -38,13 +38,13 @@ module Synchrolog
38
38
  def call(severity, timestamp, progname, message)
39
39
  anonymous_id_match = message.match(/\[synchrolog_anonymous_id:(\S*)\]/)
40
40
  anonymous_id = anonymous_id_match.try(:[], 1)
41
- message.slice!(anonymous_id_match.begin(0)..anonymous_id_match[0].length) if anonymous_id
42
-
43
- user_id_match = message.match(/\[synchrolog_user_id:(\S*)\]/)
41
+ msg = message.dup
42
+ msg.slice!(anonymous_id_match.begin(0)..anonymous_id_match[0].length) if anonymous_id
43
+ user_id_match = msg.match(/\[synchrolog_user_id:(\S*)\]/)
44
44
  user_id = user_id_match.try(:[], 1)
45
- message.slice!(user_id_match.begin(0)..user_id_match[0].length) if user_id
46
- { type: severity, timestamp: timestamp.utc.iso8601(3), message: message, anonymous_id: anonymous_id, user_id: user_id }
45
+ msg.slice!(user_id_match.begin(0)..user_id_match[0].length) if user_id
46
+ { type: severity, timestamp: timestamp.utc.iso8601(3), message: msg, anonymous_id: anonymous_id, user_id: user_id }
47
47
  end
48
48
  end
49
49
  end
50
- end
50
+ end
@@ -12,4 +12,4 @@ module Synchrolog
12
12
  end
13
13
  end
14
14
  end
15
- end
15
+ end
@@ -9,7 +9,7 @@ module Synchrolog
9
9
 
10
10
  def call env
11
11
  request = ActionDispatch::Request.new(env)
12
- if request.original_fullpath == "/synchrolog-time"
12
+ if request.original_fullpath == "/synchrolog-time"
13
13
  [ 200, {'Content-Type' => 'application/json'}, [{ time: Time.now.utc.strftime("%Y-%m-%dT%H:%M:%S.%3NZ") }.to_json] ]
14
14
  else
15
15
  if request.cookie_jar['synchrolog_anonymous_id'].nil?
@@ -19,9 +19,7 @@ module Synchrolog
19
19
  user_id = request.cookie_jar['synchrolog_user_id']
20
20
  SYNCHROLOG.logger.tagged("synchrolog_anonymous_id:#{anonymous_id}", "synchrolog_user_id:#{user_id}") do
21
21
  begin
22
- response = @app.call(env)
23
- rescue Error
24
- raise # Don't capture Synchrolog errors
22
+ response = @app.call(env)
25
23
  rescue Exception => exception
26
24
  SYNCHROLOG.exception_logger.capture(response, exception, env, anonymous_id, user_id)
27
25
  raise
@@ -33,4 +31,4 @@ module Synchrolog
33
31
  end
34
32
  end
35
33
  end
36
- end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module Synchrolog
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synchrolog-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Synchrolog.com
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-23 00:00:00.000000000 Z
11
+ date: 2019-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler