centralized_ruby_logger 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/centralized_ruby_logger.rb +6 -1
- data/lib/debug_logger.rb +28 -9
- data/lib/manager.rb +2 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3bb22fe0d8a38a7ea50b49d947081024babce01aa34f90ff8bfb7ce441dd9574
|
4
|
+
data.tar.gz: 367f73a60b64c522257eadc8202a447a8f0189956ef88808aec56dcaddf2afec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 506e90154cc95961cf3937d82ff16ce9ce0d58a80322e2c3436307f1f2614f9cf57b8ed4e0365ab5ec1b9a4d6dea7ca44d562adb8349d3167852b442a071d8b4
|
7
|
+
data.tar.gz: c6355047fa329e7be8d38e4a88e43497f302233d8fba782a56acb59ba9fb26cec12de117f71735b1c771820bd3b47ab4a562570f4ddd2354139d371ab08f2b19
|
@@ -8,10 +8,15 @@ module Coralogix
|
|
8
8
|
# Constructor.
|
9
9
|
#
|
10
10
|
# @param name - logger name.
|
11
|
-
def initialize private_key, app_name, sub_system_name, debug=false, type_name="Centralized Ruby", force_compression=false, proxy={}
|
11
|
+
def initialize private_key, app_name, sub_system_name, debug=false, type_name="Centralized Ruby", force_compression=false, proxy={}, external_logger=nil
|
12
12
|
self.debug_mode=debug
|
13
13
|
@category = CORALOGIX_CATEGORY
|
14
14
|
@manager = LoggerManager.new proxy
|
15
|
+
unless external_logger.nil?
|
16
|
+
DebugLogger.enabled = true
|
17
|
+
DebugLogger.external = true
|
18
|
+
DebugLogger.logger = external_logger
|
19
|
+
end
|
15
20
|
configure(private_key, app_name, sub_system_name, type_name, force_compression)
|
16
21
|
end
|
17
22
|
|
data/lib/debug_logger.rb
CHANGED
@@ -4,33 +4,50 @@ module Coralogix
|
|
4
4
|
# @private
|
5
5
|
class DebugLogger
|
6
6
|
|
7
|
+
# attr_accessor :external, :enabled, :logger
|
8
|
+
|
7
9
|
def self.initialize
|
8
10
|
begin
|
9
11
|
@mutex = Mutex.new
|
10
|
-
@
|
12
|
+
@enabled = false
|
13
|
+
@external = false
|
11
14
|
rescue Exception => e
|
12
|
-
if @
|
15
|
+
if @enabled
|
13
16
|
puts e.message
|
14
17
|
puts e.backtrace.inspect
|
15
18
|
end
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
22
|
+
def self.enabled=(value)
|
23
|
+
@enabled = value
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.external=(value)
|
27
|
+
@external = value
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.logger=(value)
|
31
|
+
@logger = value
|
32
|
+
end
|
33
|
+
|
19
34
|
def self.debug_mode?
|
20
|
-
@
|
35
|
+
@enabled
|
21
36
|
end
|
22
37
|
|
23
38
|
def self.debug_mode=(value)
|
24
39
|
begin
|
25
|
-
@
|
40
|
+
@enabled = value
|
26
41
|
if value
|
27
42
|
@logger = Logger.new("/tmp/#{LOG_FILE_NAME}", 1, 10485760)
|
28
43
|
else
|
29
|
-
|
30
|
-
|
44
|
+
if @external == false
|
45
|
+
@logger.close unless @logger == nil
|
46
|
+
@logger = nil
|
47
|
+
end
|
31
48
|
end
|
32
49
|
rescue Exception => e
|
33
|
-
if @
|
50
|
+
if @enabled
|
34
51
|
puts e.message
|
35
52
|
puts e.backtrace.inspect
|
36
53
|
end
|
@@ -39,10 +56,12 @@ module Coralogix
|
|
39
56
|
|
40
57
|
Logger::Severity.constants.each do |level|
|
41
58
|
define_singleton_method("#{level.downcase}") do |*args|
|
42
|
-
if @
|
59
|
+
if @enabled
|
43
60
|
@mutex.synchronize do
|
44
61
|
begin
|
45
|
-
|
62
|
+
if @external == false
|
63
|
+
puts "#{__method__.upcase}: #{Time.now.strftime('%H:%M:%S.%L')} - #{args}"
|
64
|
+
end
|
46
65
|
@logger.send("#{__method__}", args)
|
47
66
|
rescue Exception => e
|
48
67
|
puts e.message
|
data/lib/manager.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: centralized_ruby_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Royee Goldberg
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Coralogix Centralized Ruby Logger to send logs to Coralogix server.
|
14
14
|
email: royee@coralogix.com
|
@@ -27,7 +27,7 @@ homepage: http://www.coralogix.com
|
|
27
27
|
licenses:
|
28
28
|
- MIT
|
29
29
|
metadata: {}
|
30
|
-
post_install_message:
|
30
|
+
post_install_message:
|
31
31
|
rdoc_options: []
|
32
32
|
require_paths:
|
33
33
|
- lib
|
@@ -42,9 +42,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: '0'
|
44
44
|
requirements: []
|
45
|
-
rubyforge_project:
|
46
|
-
rubygems_version: 2.
|
47
|
-
signing_key:
|
45
|
+
rubyforge_project:
|
46
|
+
rubygems_version: 2.7.3
|
47
|
+
signing_key:
|
48
48
|
specification_version: 4
|
49
49
|
summary: Coralogix Centralized Ruby Logger SDK
|
50
50
|
test_files: []
|