vigilant-ruby 0.0.1 → 0.0.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 598917bbfe3086a946307f7a5722b1c134aa42f17203fcbd2efc7deed68e4778
|
4
|
+
data.tar.gz: 2b19671efaca0de013d2591d2a1d5f077582d5e16c77950f7fd9b52a29b4a97a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d02b1cffbe3eb6bf5cb5e343ddc6f631d712089e3e121a779163556aaf0d8e8cef75370f8a768eb71ecea85e1c3a7eb486f901bd4ea8bc791d85ba6614952895
|
7
|
+
data.tar.gz: 46a052c2a4f0ae1cab9083d8c50dd5b9e1a6950f893c408af5f9440a8acb41a42fed940cae98077fcd427d2222d565dc3a10148e5138735b9e38cee332908ba9
|
@@ -3,15 +3,13 @@
|
|
3
3
|
require 'net/http'
|
4
4
|
require 'json'
|
5
5
|
require 'time'
|
6
|
-
require 'vigilant/version'
|
6
|
+
require 'vigilant-ruby/version'
|
7
7
|
|
8
8
|
module Vigilant
|
9
|
-
TRACE = 'TRACE'
|
10
9
|
DEBUG = 'DEBUG'
|
11
10
|
INFO = 'INFO'
|
12
11
|
WARNING = 'WARNING'
|
13
12
|
ERROR = 'ERROR'
|
14
|
-
FATAL = 'FATAL'
|
15
13
|
|
16
14
|
DEFAULT_BATCH_SIZE = 10
|
17
15
|
DEFAULT_FLUSH_INTERVAL = 5
|
@@ -86,14 +84,6 @@ module Vigilant
|
|
86
84
|
end
|
87
85
|
end
|
88
86
|
|
89
|
-
# Logs a FATAL message.
|
90
|
-
#
|
91
|
-
# @param body [String] The main text of the fatal message.
|
92
|
-
# @param attributes [Hash] Additional attributes for the log (optional).
|
93
|
-
def fatal(body, attributes = {})
|
94
|
-
enqueue_log(FATAL, body, attributes)
|
95
|
-
end
|
96
|
-
|
97
87
|
def shutdown
|
98
88
|
flush_if_needed(true)
|
99
89
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'version'
|
4
|
-
require 'logger'
|
3
|
+
require 'vigilant-ruby/version'
|
4
|
+
require 'vigilant-ruby/logger'
|
5
5
|
|
6
6
|
# Vigilant is a logging service that provides structured logging capabilities
|
7
7
|
# with asynchronous batch processing and thread-safe operations.
|
data/sig/vigilant.rbs
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
module Vigilant
|
2
|
+
DEBUG: "DEBUG"
|
3
|
+
|
4
|
+
INFO: "INFO"
|
5
|
+
|
6
|
+
WARNING: "WARNING"
|
7
|
+
|
8
|
+
ERROR: "ERROR"
|
9
|
+
|
10
|
+
DEFAULT_BATCH_SIZE: 10
|
11
|
+
|
12
|
+
DEFAULT_FLUSH_INTERVAL: 5
|
13
|
+
|
14
|
+
# A thread-safe logger that batches logs and sends them to Vigilant asynchronously
|
15
|
+
class Logger
|
16
|
+
@token: untyped
|
17
|
+
|
18
|
+
@endpoint: untyped
|
19
|
+
|
20
|
+
@insecure: untyped
|
21
|
+
|
22
|
+
@batch_size: untyped
|
23
|
+
|
24
|
+
@flush_interval: untyped
|
25
|
+
|
26
|
+
@queue: untyped
|
27
|
+
|
28
|
+
@mutex: untyped
|
29
|
+
|
30
|
+
@batch: untyped
|
31
|
+
|
32
|
+
@shutdown: untyped
|
33
|
+
|
34
|
+
@dispatcher_thread: untyped
|
35
|
+
|
36
|
+
# Initialize a Vigilant::Logger instance.
|
37
|
+
#
|
38
|
+
# @param endpoint [String] The base endpoint for the Vigilant API (e.g. "ingress.vigilant.run").
|
39
|
+
# @param token [String] The authentication token for the Vigilant API.
|
40
|
+
# @param insecure [Boolean] Whether to use HTTP instead of HTTPS (optional, defaults to false).
|
41
|
+
def initialize: (endpoint: untyped, token: untyped, ?insecure: bool) -> void
|
42
|
+
|
43
|
+
# Logs a TRACE message.
|
44
|
+
#
|
45
|
+
# @param body [String] The main text of the trace message.
|
46
|
+
# @param attributes [Hash] Additional attributes for the log (optional).
|
47
|
+
def trace: (untyped body, ?::Hash[untyped, untyped] attributes) -> untyped
|
48
|
+
|
49
|
+
# Logs a DEBUG message.
|
50
|
+
#
|
51
|
+
# @param body [String] The main text of the debug message.
|
52
|
+
# @param attributes [Hash] Additional attributes for the log (optional).
|
53
|
+
def debug: (untyped body, ?::Hash[untyped, untyped] attributes) -> untyped
|
54
|
+
|
55
|
+
# Logs an INFO message.
|
56
|
+
#
|
57
|
+
# @param body [String] The main text of the log message.
|
58
|
+
# @param attributes [Hash] Additional attributes for the log (optional).
|
59
|
+
def info: (untyped body, ?::Hash[untyped, untyped] attributes) -> untyped
|
60
|
+
|
61
|
+
# Logs a WARNING message.
|
62
|
+
#
|
63
|
+
# @param body [String] The main text of the warning message.
|
64
|
+
# @param attributes [Hash] Additional attributes for the log (optional).
|
65
|
+
def warn: (untyped body, ?::Hash[untyped, untyped] attributes) -> untyped
|
66
|
+
|
67
|
+
# Logs an ERROR message.
|
68
|
+
#
|
69
|
+
# @param body [String] The main text of the error message.
|
70
|
+
# @param error [Exception] The error object.
|
71
|
+
# @param attributes [Hash] Additional attributes for the log (optional).
|
72
|
+
def error: (untyped body, ?untyped? error, ?::Hash[untyped, untyped] attributes) -> untyped
|
73
|
+
|
74
|
+
def shutdown: () -> untyped
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def enqueue_log: (untyped level, untyped body, untyped attributes) -> untyped
|
79
|
+
|
80
|
+
def start_dispatcher: () -> untyped
|
81
|
+
|
82
|
+
def flush_if_needed: (?bool force) -> untyped
|
83
|
+
|
84
|
+
def flush!: () -> untyped
|
85
|
+
|
86
|
+
def post_logs: (untyped batch_data) -> untyped
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
module Vigilant
|
91
|
+
VERSION: "0.0.2"
|
92
|
+
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.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vigilant
|
@@ -51,6 +51,20 @@ dependencies:
|
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '13.0'
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: rbs
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '3.1'
|
61
|
+
type: :development
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '3.1'
|
54
68
|
- !ruby/object:Gem::Dependency
|
55
69
|
name: rspec
|
56
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,9 +115,10 @@ extensions: []
|
|
101
115
|
extra_rdoc_files: []
|
102
116
|
files:
|
103
117
|
- README.md
|
104
|
-
- lib/
|
105
|
-
- lib/
|
106
|
-
- lib/vigilant.rb
|
118
|
+
- lib/vigilant-ruby.rb
|
119
|
+
- lib/vigilant-ruby/logger.rb
|
120
|
+
- lib/vigilant-ruby/version.rb
|
121
|
+
- sig/vigilant.rbs
|
107
122
|
homepage: https://vigilant.run
|
108
123
|
licenses:
|
109
124
|
- MIT
|
@@ -111,7 +126,6 @@ metadata:
|
|
111
126
|
homepage_uri: https://vigilant.run
|
112
127
|
source_code_uri: https://github.com/vigilant-run/vigilant-ruby
|
113
128
|
changelog_uri: https://vigilant.run/changelog
|
114
|
-
rubygems_mfa_required: 'true'
|
115
129
|
rdoc_options: []
|
116
130
|
require_paths:
|
117
131
|
- lib
|