plogger 0.2.0 → 0.3.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: 110fbede7ba261da02ee2861e3d5375e0e31ccea
4
- data.tar.gz: 0a832143e20bfa24ad41746b10d4f6569e6aa3de
3
+ metadata.gz: b1a7e854fc7e5332fb9c545f4077a2ad76e4aa7f
4
+ data.tar.gz: 5a78f2866a1dbc345093c72a26e99e47171a8abb
5
5
  SHA512:
6
- metadata.gz: edcab56c3b72cc592f5ceaab0bb6a7f6d5935cf24d6f1ec6092c03f94d8fc6398f0c943316091c84951a0af941cf67d9239deab788e89a239c5ab50b3a1fddc0
7
- data.tar.gz: 1250d98bd14d0a5cdd805badf2cf9a7f16475c5bc0e27bc310faf75107668601c55bf3a11cf52cef6308644227e7c5381d3a6851083eb237e600397a98a493f0
6
+ metadata.gz: ad18a381f52eea6562c3c4ca5484113db042a1983b2428780fe9dd51348c1a3445b1a3f03b0668a164ca422bbe0d02141b9d0dcad65a6b6fe9a662aa2cc3752f
7
+ data.tar.gz: d4788a60119670664487f7e4b8f9e4a3d552e26d4f9380c8f8f0823b790df4f6b1551d20faac995398e12532b6bd95e6417dfab08a09e4b7fdf7a5ab9fa239fd
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ plogger-*.gem
data/README.md CHANGED
@@ -55,5 +55,5 @@ Example call:
55
55
 
56
56
  ```ruby
57
57
  Plogger.info("Processing ready", type: 'user', category: "Bundle Creation", user_id: 1, extra_info: {happy: "yes"})
58
- # Will output 'Processing ready -- type='user' category='Bundle Creation' user_id=1 happy='yes'
58
+ # Will output 'Processing ready -- trace=194fjx43gp type='user' category='Bundle Creation' user_id=1 happy='yes'
59
59
  ```
@@ -1,12 +1,24 @@
1
1
  module Plogger
2
2
  class Formatter
3
- def self.format(message, trace, type: 'system', user_id: 'null', account_id: 'null', category: '', extra_info: {})
4
- result = "#{message} -- type='#{type}' category='#{category}' user_id=#{user_id} account_id=#{account_id} trace=#{trace}"
3
+ def self.format(message, trace, type: 'system', user_id: nil, account_id: nil, category: '', extra_info: {})
4
+ result = "#{message} -- trace='#{trace}'"
5
+ args = {type: type, category: category, user_id: user_id, account_id: account_id}
6
+ args.each do |key, value|
7
+ result = add_param_to_message(result, key, value) unless value.nil?
8
+ end
9
+
5
10
  extra_info.keys.each do |key|
6
- is_string = extra_info[key].class == String
7
- result += " #{key}=#{is_string ? "'" : ''}#{extra_info[key]}#{is_string ? "'" : ''}"
11
+ result = add_param_to_message(result, key, extra_info[key])
8
12
  end
9
13
  result
10
14
  end
15
+
16
+ def self.add_param_to_message(message, key, value)
17
+ result = message
18
+ is_string = value.class == String
19
+ result += " #{key}=#{is_string ? "'" : ''}#{value}#{is_string ? "'" : ''}"
20
+ result
21
+ end
22
+
11
23
  end
12
24
  end
@@ -1,3 +1,3 @@
1
1
  module Plogger
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plogger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Merrill