spspub_log 0.1.2 → 0.2.0
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 +5 -5
- checksums.yaml.gz.sig +3 -3
- data.tar.gz.sig +3 -1
- data/lib/spspub_log.rb +74 -7
- metadata +27 -24
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: ed84606685b2f006b7c0664ef828bb6e345d074ba5862f47b44c58d252d28beb
|
|
4
|
+
data.tar.gz: 8de34432167106b3ffc39c15099fc90930a4189a00619adf94070ea113d7a054
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad85b1619383294f75f93bbe56a5b5f70465456c42a8444473fd5fd94d541f5857da18bd40ed32d611095d11ec11e84c5c8c06d76e4339c66c97aab58eb08e78
|
|
7
|
+
data.tar.gz: 31e48e27374486e2b70dfbb66512de74397cb305abbb088cc0dd22c779134e8ee74002704fdd9f699080ac8c73aba71a629b217c63bfe05021c387f12d2d574d
|
checksums.yaml.gz.sig
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
��@�� /jc���)��4���j"�N���jt&�(�ӎ/��Us�8� �<��b�
|
|
2
|
+
?��K}�"�o���mH���5b����q������<Z�WF/��37��t�*_/?ʳ\g��k-t���"N�^fC|*/���{n�,�y�4��C
|
|
3
|
+
u�-�U�{e&q��07��ch�H�G�hXP>E�e�D���P��ʆ��AS�c�9���F��,�x���?�d��8Kc#� #*�dx"ȿC�����WQ�\�q�1����j�d�A��d�N�8+��:�1�+��9.$EX��j��������Q��{>rBc�'���(��*�_�̲ϳr��d y,~�Z�i���E{
|
data.tar.gz.sig
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
���^��L�w�'�[Q���5S
|
|
2
|
+
�����/h�ĉ����Â�OO�S�^5��������|�2#���C�d�B�E1�y�w���7vNA����(�-�9�Қ2��wa���}Q� �
|
|
3
|
+
���T �F{���Qj����`�r3�q�V���ܓ�5G��ٚ≯|����xo�����?2���af���<�6sθɚ�Å����
|
data/lib/spspub_log.rb
CHANGED
|
@@ -5,32 +5,99 @@
|
|
|
5
5
|
require 'sps-pub'
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class SPSPubLog
|
|
8
|
+
class SPSPubLog
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
module Severity
|
|
13
|
+
# Low-level information, mostly for developers.
|
|
14
|
+
DEBUG = 0
|
|
15
|
+
# Generic (useful) information about system operation.
|
|
16
|
+
INFO = 1
|
|
17
|
+
# A warning.
|
|
18
|
+
WARN = 2
|
|
19
|
+
# A handleable error condition.
|
|
20
|
+
ERROR = 3
|
|
21
|
+
# An unhandleable error that results in a program crash.
|
|
22
|
+
FATAL = 4
|
|
23
|
+
# An unknown message that should always be logged.
|
|
24
|
+
UNKNOWN = 5
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
DEBUG = Severity::DEBUG
|
|
28
|
+
INFO = Severity::INFO
|
|
29
|
+
WARN = Severity::WARN
|
|
30
|
+
ERROR = Severity::ERROR
|
|
31
|
+
FATAL = Severity::FATAL
|
|
32
|
+
UNKNOWN = Severity::UNKNOWN
|
|
33
|
+
|
|
34
|
+
attr_accessor :level
|
|
35
|
+
|
|
9
36
|
|
|
10
37
|
def initialize(host: 'sps', address: host, port: '59000', topic: 'log',
|
|
11
|
-
charlimit:
|
|
12
|
-
|
|
13
|
-
@
|
|
38
|
+
charlimit: 280, level: Severity::DEBUG, subtopic: '')
|
|
39
|
+
|
|
40
|
+
@sps = SPSPub.new(host: host, address: host, port: port)
|
|
41
|
+
|
|
42
|
+
@level = set_level level
|
|
43
|
+
|
|
44
|
+
@topic, @charlimit, @subtopic = topic, charlimit, subtopic
|
|
14
45
|
sleep 0.05
|
|
15
46
|
end
|
|
16
47
|
|
|
17
48
|
def debug(raw_msg)
|
|
49
|
+
return if @level > Severity::DEBUG
|
|
18
50
|
pub_msg raw_msg
|
|
19
51
|
end
|
|
52
|
+
|
|
53
|
+
def error(raw_msg)
|
|
54
|
+
return if @level > Severity::ERROR
|
|
55
|
+
pub_msg raw_msg, :error
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def fatal(raw_msg)
|
|
59
|
+
return if @level > Severity::FATAL
|
|
60
|
+
pub_msg raw_msg, :fatal
|
|
61
|
+
end
|
|
20
62
|
|
|
21
63
|
def info(raw_msg)
|
|
64
|
+
return if @level > Severity::INFO
|
|
22
65
|
pub_msg raw_msg, :info
|
|
23
66
|
end
|
|
67
|
+
|
|
68
|
+
def level()
|
|
69
|
+
@level
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def level=(val)
|
|
73
|
+
@level = set_level val
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def unknown(raw_msg)
|
|
77
|
+
pub_msg raw_msg, :unknown
|
|
78
|
+
end
|
|
24
79
|
|
|
25
80
|
private
|
|
26
81
|
|
|
27
82
|
def pub_msg(s, label=:debug)
|
|
28
83
|
|
|
29
84
|
fullmsg, topic = s.split(/ *: */,2).reverse
|
|
30
|
-
msg = fullmsg.length <= @charlimit ? fullmsg :
|
|
31
|
-
|
|
85
|
+
msg = fullmsg.length <= @charlimit ? fullmsg : \
|
|
86
|
+
fullmsg[0..@charlimit - 3] + '...'
|
|
87
|
+
fqm = [@topic, label.to_s, topic || @subtopic].compact.join('/') + ': ' \
|
|
88
|
+
+ msg
|
|
89
|
+
|
|
90
|
+
@sps.notice(fqm)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def set_level(level)
|
|
94
|
+
|
|
95
|
+
if level.is_a? Symbol then
|
|
96
|
+
%i(debug info warn error fatal unknown).zip(0..5).to_h[level]
|
|
97
|
+
else
|
|
98
|
+
level
|
|
99
|
+
end
|
|
32
100
|
|
|
33
|
-
notice(fqm)
|
|
34
101
|
end
|
|
35
102
|
|
|
36
103
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spspub_log
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Robertson
|
|
@@ -10,28 +10,32 @@ bindir: bin
|
|
|
10
10
|
cert_chain:
|
|
11
11
|
- |
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTkxMDI5MTg1OTI2WhcN
|
|
15
|
+
MjAxMDI4MTg1OTI2WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDjlj7m
|
|
17
|
+
cIp9swKubKzac78Xm4kW16bOoeJhvWqzWDWCJw9DzvGJFOkOspkJsxhn7EXjSmjQ
|
|
18
|
+
2xtgRseQEARQBwmBzOUsljZ7oTZ5zIzaxPMeHxVtqchveIz7RgVRq3rCo0FmK6+U
|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UF7dje82OC3gB17zrnoOv+13IGTxpgPrdqKeyyXusL7H6fV
|
|
34
|
+
RDGl3j0h84GFxqKkefbJkC2rNnY3ACkhN0yrj4nepno22iLx0RevtO4Zr5lEnseC
|
|
35
|
+
XToe05II/XyDjYqchBGw3m7RgLskHvYM2xm1YAO3X8fX7i8LphIFKknB9J224bdF
|
|
36
|
+
eukPykc2PJ2r5xiGFX6lL2MX
|
|
33
37
|
-----END CERTIFICATE-----
|
|
34
|
-
date:
|
|
38
|
+
date: 2019-10-29 00:00:00.000000000 Z
|
|
35
39
|
dependencies:
|
|
36
40
|
- !ruby/object:Gem::Dependency
|
|
37
41
|
name: sps-pub
|
|
@@ -79,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
79
83
|
- !ruby/object:Gem::Version
|
|
80
84
|
version: '0'
|
|
81
85
|
requirements: []
|
|
82
|
-
|
|
83
|
-
rubygems_version: 2.6.13
|
|
86
|
+
rubygems_version: 3.0.3
|
|
84
87
|
signing_key:
|
|
85
88
|
specification_version: 4
|
|
86
89
|
summary: 'Publishes log messages instead of logging them to file. #debug #debugging
|
metadata.gz.sig
CHANGED
|
Binary file
|