elastic-logger 0.2.4 → 0.2.5
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/README.md +3 -0
- data/lib/elastic-logger/configuration.rb +2 -1
- data/lib/elastic-logger/logger.rb +5 -1
- data/lib/elastic-logger/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8843e1c0329cf9c32997f6e7d05ba3f1d020a2f4
|
4
|
+
data.tar.gz: f359a0174b97a0b7a82c08afda2035e674ad8838
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7caf810deabdc79411ae465504b75fdca03bdc37a99a49963a7dcec777945c167fbeeea2091276fdc41c6acef19367ee4435dbab41649f422e7ecc627df8b71f
|
7
|
+
data.tar.gz: d868521f62437f0a2b6f0d7a3df6003f92639582917e5019dad3d214ef00f11cc964c4e1a6995a3c07fa5d7fd3474cfc5037c8d18b3697292fa04a17364b76bf
|
data/README.md
CHANGED
@@ -31,6 +31,7 @@ ElasticLogger.configure do |config|
|
|
31
31
|
config.host = '192.168.60.10:9200'
|
32
32
|
types_file = 'config/elastic_log_config.yml'
|
33
33
|
path = 'log'
|
34
|
+
prefix = ''
|
34
35
|
end
|
35
36
|
```
|
36
37
|
|
@@ -51,6 +52,8 @@ api_requests:
|
|
51
52
|
```
|
52
53
|
### Usage
|
53
54
|
|
55
|
+
`sidekiq_monitor` is a name of log it will be used with `prefix` to build file name or index name in elastic.
|
56
|
+
|
54
57
|
```ruby
|
55
58
|
logger = ElasticLogger::Logger.new('sidekiq_monitor')
|
56
59
|
logger.log(foo: :bar)
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module ElasticLogger
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :host, :types_file, :path
|
3
|
+
attr_accessor :host, :types_file, :path, :prefix
|
4
4
|
|
5
5
|
def initialize
|
6
6
|
@host = 'localhost:9200'
|
7
7
|
@types_file = 'config/elastic_log_types.yml'
|
8
8
|
@path = 'log'
|
9
|
+
@prefix = ''
|
9
10
|
end
|
10
11
|
end
|
11
12
|
end
|
@@ -18,7 +18,11 @@ module ElasticLogger
|
|
18
18
|
|
19
19
|
def writer
|
20
20
|
writer = logs.fetch(name, default).fetch("writer")
|
21
|
-
Object.const_get(writer).new(name:
|
21
|
+
Object.const_get(writer).new(name: log_name, config: config)
|
22
|
+
end
|
23
|
+
|
24
|
+
def log_name
|
25
|
+
[config.prefix, name].map(&:to_s).reject(&:empty?).join("_")
|
22
26
|
end
|
23
27
|
|
24
28
|
def config
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Radosław Woźnik
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-10-
|
12
|
+
date: 2017-10-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|