chili_logger 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.byebug_history +24 -0
- data/Gemfile.lock +1 -1
- data/README.md +9 -8
- data/lib/chili_logger.rb +1 -0
- data/lib/chili_logger/version.rb +1 -1
- data/lib/helpers/rails_backtrace_cleaner.rb +1 -1
- data/lib/logs_coverage/coverage_writer.rb +28 -4
- data/lib/message_writer/message_writer.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10b5fc2b3c38931ea3e011926d0b53bde8c815afa458355551141c4e0848c210
|
4
|
+
data.tar.gz: ba11f3e2061537c5ac53b2082154678c534409ee6114b6e7eabbd538231db8e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b89430120e833f374bcd1e5e4613184f450228ba787d7e0a0bd0a4ae7932bd73cdaac480bc06a8b5b3a594c9f6721b5ef27ab6911e625441b7c3d90cf13ec499
|
7
|
+
data.tar.gz: 4498034a82c5ced13a1a342e0dc449ebf6872806a50544eaa85ecc4d251f7d3c85e097b1e528d6ff850f4fbe806b5481342f2cb23de3be0f57cd170006ab8fe9
|
data/.byebug_history
CHANGED
@@ -1,4 +1,28 @@
|
|
1
1
|
continue
|
2
|
+
cloud_metadata[@cloud_provider]
|
3
|
+
@cloud_provider
|
4
|
+
continue
|
5
|
+
@cloud_provider
|
6
|
+
continue
|
7
|
+
@cloud_provider
|
8
|
+
continue
|
9
|
+
@cloud_provider
|
10
|
+
continue
|
11
|
+
@cloud_provider
|
12
|
+
continue
|
13
|
+
@cloud_provider
|
14
|
+
continue
|
15
|
+
@cloud_provider
|
16
|
+
continue
|
17
|
+
@cloud_provider
|
18
|
+
continue
|
19
|
+
cloud_metadata[nil]
|
20
|
+
@cloud_provider
|
21
|
+
continue
|
22
|
+
@ip
|
23
|
+
@user
|
24
|
+
@port
|
25
|
+
continue
|
2
26
|
msg[type.to_sym]
|
3
27
|
msg[type]
|
4
28
|
pp msg
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -21,8 +21,9 @@ Or install it yourself as:
|
|
21
21
|
$ gem install chili_logger
|
22
22
|
|
23
23
|
|
24
|
-
|
24
|
+
Create a initializer file and configure ChiliLogger passing all the relevant informations:
|
25
25
|
```ruby
|
26
|
+
# config/initializers/chili_logger.rb
|
26
27
|
require 'chili_logger'
|
27
28
|
|
28
29
|
is_deactivated = Rails.env.test?
|
@@ -31,16 +32,16 @@ ChiliLogger.instance.config({
|
|
31
32
|
deactivated: is_deactivated,
|
32
33
|
log_env: 'development',
|
33
34
|
log_layer: 'creatives',
|
34
|
-
server_url: ENV['
|
35
|
+
server_url: ENV['SERVER_URL'],
|
35
36
|
cloud_provider: :aws,
|
36
37
|
msg_broker_name: :rabbitmq,
|
37
38
|
msg_broker_config: {
|
38
|
-
user: '
|
39
|
-
password: '
|
40
|
-
ip: '
|
41
|
-
port: '
|
42
|
-
exchange_name: '
|
43
|
-
routing_key: '
|
39
|
+
user: ENV['RABBIT_USER'],
|
40
|
+
password: ENV['RABBIT_PASSWORD'],
|
41
|
+
ip: ENV['RABBIT_IP'],
|
42
|
+
port: ENV['RABBIT_PORT'],
|
43
|
+
exchange_name: ENV['RABBIT_EXCHANGE'],
|
44
|
+
routing_key: ENV['RABBIT_ROUTING_KEY']
|
44
45
|
}
|
45
46
|
})
|
46
47
|
```
|
data/lib/chili_logger.rb
CHANGED
data/lib/chili_logger/version.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
require 'yaml'
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
4
|
# class for centralizing Creative's logging logic
|
4
5
|
class ChiliLogger
|
5
6
|
# class for keeping logs coverage up to date
|
6
7
|
class CoverageWriter
|
7
8
|
def self.write(desc, backtrace)
|
8
|
-
|
9
|
-
coverage = YAML.load_file(coverage_path) || {}
|
9
|
+
coverage = read_file
|
10
10
|
|
11
11
|
type = desc[:type]
|
12
12
|
service = desc[:service]
|
13
13
|
action = desc[:action]
|
14
|
-
|
15
14
|
keys = [type, service, action]
|
15
|
+
|
16
16
|
coverage = add_nested_value(coverage, keys, backtrace)
|
17
17
|
|
18
|
-
|
18
|
+
write_file(coverage)
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.add_nested_value(object, keys, final_value)
|
@@ -28,5 +28,29 @@ class ChiliLogger
|
|
28
28
|
|
29
29
|
object
|
30
30
|
end
|
31
|
+
|
32
|
+
def self.read_file
|
33
|
+
file_exists = File.file?(file_path)
|
34
|
+
|
35
|
+
file_exists ? YAML.load_file(file_path) : {}
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.write_file(file)
|
39
|
+
FileUtils.mkdir(dir_name) unless File.directory?(dir_name)
|
40
|
+
File.open(file_path, 'w') { |f| YAML.dump(file, f) }
|
41
|
+
true
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.dir_name
|
45
|
+
'log'
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.file_name
|
49
|
+
'chili-logger-coverage.yml'
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.file_path
|
53
|
+
File.join('.', dir_name, file_name)
|
54
|
+
end
|
31
55
|
end
|
32
56
|
end
|