testa_logger 0.1.13 → 0.1.16

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: 392ec3ccd72f4d52d615240dc7e973ac69e16eaf5f59673cfc0093e71de69881
4
- data.tar.gz: e3c65498f51ebd5c4f75c1468f7f4e0cdb1ac79a0035a8e8c922f096fb832231
3
+ metadata.gz: 6bccba94675dff6f881b604cec301bcea54e1a99b653db95c7ce156ddf8104de
4
+ data.tar.gz: '05984a867c873368a4da65b0539a7e981cc0119e5076d142408e725066121cc4'
5
5
  SHA512:
6
- metadata.gz: 6cbfb98e8904580b1c9c00025091733b33e13acc58a00c52b9d427570b41651eb93ea467e71a9bd70f2d622c2564dfeff25c02e61d0b22d0e4ec74c5326426a3
7
- data.tar.gz: 4b2e44b86308dedc7bac95abb5b7677c7e42785c515cbf30f78bf3c1f606316a2429fce72deeab19dd0d8e48dc6ea78ab269899c21e2372f7e212ecfd8dc79b6
6
+ metadata.gz: 9995ca14b6c4b97370c2600ee5c401f6e8b54447f402d776e3e7f2882ef91d7cb724a0ecea3d418125991b11531ca0f5a2fcc7a7aba611c15b4e60f482a08022
7
+ data.tar.gz: 15f463df8811cb1d16a72dfbb8b57f440fd73d55eb3ed8566ccc729b47b76831c3889679bf76c6749f406d6eeb66827be94a78275175c9c180dfeda6ece5bbe2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- testa_logger (0.1.13)
4
+ testa_logger (0.1.16)
5
5
  activesupport
6
6
  awesome_print
7
7
  aws-sdk-s3
@@ -9,6 +9,9 @@ module TestaLogger
9
9
  def initialize(logger, faye_url, faye_token)
10
10
  @logger = logger
11
11
  @uri = URI.parse(faye_url)
12
+ @http = Net::HTTP.new(@uri.host, @uri.port)
13
+ @http.read_timeout = 2
14
+ @http.open_timeout = 2
12
15
  @faye_token = faye_token
13
16
  @channel = "/logs/live/#{logger.app}/#{logger.group}"
14
17
  @channel += "/#{logger.subgroup}" unless logger.subgroup.nil?
@@ -57,7 +60,10 @@ module TestaLogger
57
60
  data: { logs: @outbox },
58
61
  ext: { auth_token: @faye_token },
59
62
  }
60
- Net::HTTP.post_form(@uri, message: message.to_json)
63
+
64
+ request = Net::HTTP::Post.new(@uri.request_uri)
65
+ request.form_data = { message: message.to_json }
66
+ @http.request(request)
61
67
  @outbox.clear
62
68
  end
63
69
  end
@@ -44,6 +44,7 @@ module TestaLogger
44
44
  }
45
45
 
46
46
  handle_user_options(options)
47
+ @live = false if app == "ws" # will cause endless loop otherwise
47
48
  end
48
49
 
49
50
  def format_app_and_groups(app, group, subgroup)
@@ -80,27 +80,27 @@ module TestaLogger
80
80
  options.formatter
81
81
  end
82
82
 
83
- def debug(tag = NO_TAG, *args, &block)
83
+ def debug(tag = "", *args, &block)
84
84
  add_log_to_queue(DEBUG, tag, args, &block)
85
85
  end
86
86
 
87
- def info(tag = NO_TAG, *args, &block)
87
+ def info(tag = "", *args, &block)
88
88
  add_log_to_queue(INFO, tag, args, &block)
89
89
  end
90
90
 
91
- def warn(tag = NO_TAG, *args, &block)
91
+ def warn(tag = "", *args, &block)
92
92
  add_log_to_queue(WARN, tag, args, &block)
93
93
  end
94
94
 
95
- def error(tag = NO_TAG, *args, &block)
95
+ def error(tag = "", *args, &block)
96
96
  add_log_to_queue(ERROR, tag, args, &block)
97
97
  end
98
98
 
99
- def fatal(tag = NO_TAG, *args, &block)
99
+ def fatal(tag = "", *args, &block)
100
100
  add_log_to_queue(FATAL, tag, args, &block)
101
101
  end
102
102
 
103
- def unknown(tag = NO_TAG, *args, &block)
103
+ def unknown(tag = "", *args, &block)
104
104
  add_log_to_queue(UNKNOWN, tag, args, &block)
105
105
  end
106
106
 
@@ -212,6 +212,8 @@ module TestaLogger
212
212
  formatted_severity = format_severity(level)
213
213
  formatted_text = format_message(formatted_severity, time, "", text)
214
214
 
215
+ # after forking process, write thread will stop working in the forked process
216
+ start_write_thread if @write_thread.nil? || @write_thread.status == false
215
217
  @queue << formatted_text
216
218
  @dispatcher.push(level, time, tag, formatted_text) if options.live
217
219
  end
@@ -1,3 +1,3 @@
1
1
  module TestaLogger
2
- VERSION = "0.1.13"
2
+ VERSION = "0.1.16"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testa_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - karlo.razumovic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-17 00:00:00.000000000 Z
11
+ date: 2022-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport