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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0280598c4039160580005f39571754a95907101b616c6d3c8354da14eefb5de
4
- data.tar.gz: 9ddebfc7149b3950006c8b45c0471955b00af3f99b2b88ffbf8754ed20d2187f
3
+ metadata.gz: 6f7f1ed256105eb26d3eca1221963c0cb0db06d2fab56630059fc3fc7d064e34
4
+ data.tar.gz: ff68b2953e375a0e9e741914aca017b614b689870ba4e728e8d153d496c8e38f
5
5
  SHA512:
6
- metadata.gz: 7d97948a8d9aef93514e6caa314caa4a502a721d21bc55dbe6fabcc1a98845718b6285da5ecf967a5e4554bb8157dc6d999613399e730f96103a4a254ae336a6
7
- data.tar.gz: c47a61a034ee4271c7de661a765ca50fddf632c56b62a29bd8225127230fe04b4c3a5f788be0b1fd13d248e405f57e16e272f0705d66ae0161d6eeeb6ddbd80b
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
  )
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vigilant
4
- VERSION = '0.0.5'
4
+ VERSION = '0.0.6'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vigilant-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vigilant