heavylog 0.0.6 → 0.0.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: c4f2f4bdbb5f72c23e7308fc62168ba9c8e8d132146984889c41235fe5cac73a
4
- data.tar.gz: 759a9ed8c5180282772282f7a19a5e25b697184cf892236fe30fe1aeb005615c
3
+ metadata.gz: 055e614a6c0fc73c6621118fb43e559ce1ddda63ea985345b43d489ccde63127
4
+ data.tar.gz: ca0a8fefe033be2369c50ea8dcd0d97f3d66dc539fb0c2e71599ef35f059c780
5
5
  SHA512:
6
- metadata.gz: b678d4698a7511535d6b4c492d56ce832ae699a57e7b6a992d5b2371bb4b3739d131e3cea60e2b6b9930c7fb556847c7acaff56cc09b50d8d6e4b0c23a161e4b
7
- data.tar.gz: 83dbe0859ce53c144648d0088b57a8151bb9325d7b9b27fec6299895a90c72ba5e0906dfcb301d6104398225a42c06f891aefd74c654fe2677ac4413e46c6cd1
6
+ metadata.gz: bdb4fa0c09407ffa4f677b9f0e732dbfe8f634aef428cd28176a94c31cbdf9f7d00385d1acdc92df8cbb17d0cbb55cfff749b1c86ffd8db8b1d3abb9cc92b442
7
+ data.tar.gz: 17e1f87ecb6bcc5bbea21f052806c0a7d2d0d24ed3e0f1f850ac70aaeb70310fea97993a96729effcd3a494eba926ab1cf7c476e803470789503c14c25250aa8
@@ -1,3 +1,3 @@
1
1
  module Heavylog
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
data/lib/heavylog.rb CHANGED
@@ -76,7 +76,7 @@ module Heavylog
76
76
 
77
77
  RequestStore.store[:heavylog_buffer] ||= StringIO.new
78
78
 
79
- if RequestStore.store[:heavylog_buffer].length + message.bytesize > config.message_limit
79
+ if RequestStore.store[:heavylog_buffer].length + message_size(message) > config.message_limit
80
80
  RequestStore.store[:heavylog_buffer].truncate(0)
81
81
  RequestStore.store[:heavylog_buffer].puts(TRUNCATION)
82
82
  RequestStore.store[:heavylog_truncated] = true
@@ -106,6 +106,12 @@ module Heavylog
106
106
  return OrderedOptions.new if !application
107
107
  application.config.heavylog
108
108
  end
109
+
110
+ def message_size(message)
111
+ return message.bytesize if message.respond_to?(:bytesize)
112
+ return message.map(&:to_s).sum(&:bytesize) if message.is_a?(Array)
113
+ message.length
114
+ end
109
115
  end
110
116
 
111
117
  require 'heavylog/railtie' if defined?(Rails)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heavylog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kristjan Rang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-19 00:00:00.000000000 Z
11
+ date: 2018-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler