vigilant-ruby 0.0.5 → 0.0.6
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 +2 -0
- data/lib/vigilant-ruby/logger.rb +8 -2
- data/lib/vigilant-ruby/version.rb +1 -1
- 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: 6f7f1ed256105eb26d3eca1221963c0cb0db06d2fab56630059fc3fc7d064e34
|
4
|
+
data.tar.gz: ff68b2953e375a0e9e741914aca017b614b689870ba4e728e8d153d496c8e38f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 931ce0b4a70c782502d0771cf967517d8cc58556f2a69b0fc9a65195f7065f22df5cbcdf538fd5f568a24f2f2625b5fd3bac75f2a181585ceec8f06ee037c4f2
|
7
|
+
data.tar.gz: f7bf06387f135895cc032b9af406bf5ef2b19d3fc41796d8a2ddbb563fa4f55cfcc570faa489f55c524c7a20e1807919b0c11e60feef4431d502a061b2f279ce
|
data/README.md
CHANGED
@@ -15,6 +15,7 @@ require 'vigilant-ruby'
|
|
15
15
|
|
16
16
|
# Initialize the logger
|
17
17
|
logger = Vigilant::Logger.new(
|
18
|
+
name: 'test-app',
|
18
19
|
endpoint: "ingress.vigilant.run",
|
19
20
|
token: "tk_0000000000000000",
|
20
21
|
)
|
@@ -39,6 +40,7 @@ require 'vigilant-ruby'
|
|
39
40
|
|
40
41
|
# Initialize the logger
|
41
42
|
logger = Vigilant::Logger.new(
|
43
|
+
name: 'test-app',
|
42
44
|
endpoint: "ingress.vigilant.run",
|
43
45
|
token: "tk_0000000000000000",
|
44
46
|
)
|
data/lib/vigilant-ruby/logger.rb
CHANGED
@@ -18,11 +18,13 @@ module Vigilant
|
|
18
18
|
class Logger
|
19
19
|
# Initialize a Vigilant::Logger instance.
|
20
20
|
#
|
21
|
+
# @param name [String] The name of the application.
|
21
22
|
# @param endpoint [String] The base endpoint for the Vigilant API (e.g. "ingress.vigilant.run").
|
22
23
|
# @param token [String] The authentication token for the Vigilant API.
|
23
24
|
# @param insecure [Boolean] Whether to use HTTP instead of HTTPS (optional, defaults to false).
|
24
25
|
# @param passthrough [Boolean] Whether to also print logs to stdout/stderr (optional, defaults to true).
|
25
|
-
def initialize(endpoint:, token:, insecure: false, passthrough: true)
|
26
|
+
def initialize(endpoint:, token:, name: 'test-app', insecure: false, passthrough: true)
|
27
|
+
@name = name
|
26
28
|
@token = token
|
27
29
|
|
28
30
|
protocol = insecure ? 'http://' : 'https://'
|
@@ -106,7 +108,7 @@ module Vigilant
|
|
106
108
|
timestamp: Time.now.utc.strftime('%Y-%m-%dT%H:%M:%S.%9NZ'),
|
107
109
|
body: body.to_s,
|
108
110
|
level: level.to_s,
|
109
|
-
attributes: attributes.transform_values(&:to_s)
|
111
|
+
attributes: internal_attributes.merge(attributes.transform_values(&:to_s))
|
110
112
|
}
|
111
113
|
|
112
114
|
@queue << log_msg
|
@@ -165,6 +167,10 @@ module Vigilant
|
|
165
167
|
|
166
168
|
http.request(request)
|
167
169
|
end
|
170
|
+
|
171
|
+
def internal_attributes
|
172
|
+
{ 'service.name' => @name }
|
173
|
+
end
|
168
174
|
end
|
169
175
|
|
170
176
|
# Interceptor for capturing stdout
|