yal 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +3 -0
- data/lib/yal.rb +88 -0
- metadata +91 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: faa39b8f8452eb7d1f3201571a68a56c36f49f58b2e8c7d3bc5c7801519cb07a
|
4
|
+
data.tar.gz: 75d2e3563c5b3ddd74e208d6d6278b0efa94a6e6780f6ab00561a874eb0497b2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6a3c0565036fd06f0404c8d1ffc150a7dfb114178b3c654648a52a550f7a1648131f96eb051dc096dcb546e76251da0f8b5e4421397337e4c4ac918e98ab1eb6
|
7
|
+
data.tar.gz: cd2605ebe1d673243964647cd980d352cafd744b4e4ca2d242111aa7b640d96c09e7ef686fe8eb7ca8efee3b153f3b99f10c64cc5c194cfff42276d3ace80c60
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
@@ -0,0 +1,3 @@
|
|
1
|
+
IdJc"lc�yV�n$�I�+?I��Q@� 'g������~���&v�����ڲ`ᨩ��[wsG]�pR���ZB=��m&+qms
|
2
|
+
��+R�ר�xE�i���]їګ>l#˄�<�t1��E��:)�h� ����8 �p��U�ʩAQ��0;��r,}36WUk�8�ڃM��ܳ��8��͇��j��93$�k��\�c7b�c�Z^2�|
|
3
|
+
��Ut��A}?=R�GՈ4^=�pֽ�i�ݦ�q�9:?�}�a0�>^���H�%\F0�)f|�N����4�8*i=n7�ɗ���C�f~���a�JsU��~���\��<�Xө=?N����D�v���}�Ч��
|
data/lib/yal.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: yal.rb
|
4
|
+
|
5
|
+
# description: Yet Another Logger (YAL) logs debug and info messages
|
6
|
+
# using a simple UDPSocket while logging error and fatal
|
7
|
+
# messages using the spspublog_drb_client gem.
|
8
|
+
|
9
|
+
require 'socket'
|
10
|
+
require 'spspublog_drb_client'
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
class Yal
|
15
|
+
|
16
|
+
class UDPlog
|
17
|
+
|
18
|
+
def initialize(address='127.0.0.1', port=1024, topic='udplog',
|
19
|
+
maxcharlength=280, subtopic: '')
|
20
|
+
|
21
|
+
@u = UDPSocket.new
|
22
|
+
@address, @port, @topic, @subtopic = address, port, topic, subtopic
|
23
|
+
@maxcharlength = maxcharlength
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
def debug(s)
|
28
|
+
log_message s
|
29
|
+
end
|
30
|
+
|
31
|
+
def error(s)
|
32
|
+
log_message(s, :error)
|
33
|
+
end
|
34
|
+
|
35
|
+
def fatal(s)
|
36
|
+
log_message(s, :fatal)
|
37
|
+
end
|
38
|
+
|
39
|
+
def info(s)
|
40
|
+
log_message(s, :info)
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def log_message(s, label=:debug)
|
46
|
+
|
47
|
+
charlimit = @maxcharlength
|
48
|
+
fullmsg, topic = s.split(/ *: */,2).reverse
|
49
|
+
|
50
|
+
msg = fullmsg.length <= charlimit ? fullmsg : \
|
51
|
+
fullmsg[0..charlimit - 3] + '...'
|
52
|
+
fqm = [@topic, label.to_s, topic || @subtopic]\
|
53
|
+
.compact.join('/') + ': ' + msg
|
54
|
+
@u.send fqm, 0, @address, @port
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def initialize(sps_host: nil, sps_port: 59000,
|
59
|
+
udp_host: '127.0.0.1', udp_port: '1024', subtopic: '')
|
60
|
+
|
61
|
+
@udplog = UDPlog.new(udp_host, udp_port, topic='udplog',
|
62
|
+
subtopic: subtopic)
|
63
|
+
|
64
|
+
if sps_host then
|
65
|
+
@spslog = SPSPubLogDRbClient.new(host: sps_host, port: sps_port)
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
def debug(s)
|
71
|
+
@udplog.debug s
|
72
|
+
end
|
73
|
+
|
74
|
+
def error(s)
|
75
|
+
@udplog.error s
|
76
|
+
@spslog.error s if @spslog
|
77
|
+
end
|
78
|
+
|
79
|
+
def fatal(s)
|
80
|
+
@spslog.fatal s if @spslog
|
81
|
+
end
|
82
|
+
|
83
|
+
def info(s)
|
84
|
+
@udplog.info s
|
85
|
+
end
|
86
|
+
|
87
|
+
|
88
|
+
end
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yal
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTkxMDI5MTMxMzI5WhcN
|
15
|
+
MjAxMDI4MTMxMzI5WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCs3jHV
|
17
|
+
lgmiKEYQvOr7C0wBSGw96foUlQGtUk+j7et+MPzRK7rLQ+DqvNp4AIUBzOQCzCPs
|
18
|
+
Db/F2OpTJmSYdQPbxqr9h2g0budNku0QguOED6mJe2qEHyEUgUWxXP5Krsd3nxmi
|
19
|
+
5xALclC2KwaA2TE7X5HVy6kEp9vrjFwUfR+iYjUu5f720GmaN20IqYAkGzBy+2Kj
|
20
|
+
YAXd4vL9B78n/UIkvVLnvVBlT9dKa7YYeK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35
|
+
Q9FjA+3dDHN0k0G3A2aRAqRSWFWKiqQV587G7u+Jb+QDHeVScqM130STdbhhso8d
|
36
|
+
wbJ1bMbddB6aGCP04pLyREBq
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
date: 2019-10-29 00:00:00.000000000 Z
|
39
|
+
dependencies:
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: spspublog_drb_client
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.1'
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.1.1
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0.1'
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.1.1
|
60
|
+
description:
|
61
|
+
email: james@jamesrobertson.eu
|
62
|
+
executables: []
|
63
|
+
extensions: []
|
64
|
+
extra_rdoc_files: []
|
65
|
+
files:
|
66
|
+
- lib/yal.rb
|
67
|
+
homepage: https://github.com/jrobertson/yal
|
68
|
+
licenses:
|
69
|
+
- MIT
|
70
|
+
metadata: {}
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubygems_version: 3.0.3
|
87
|
+
signing_key:
|
88
|
+
specification_version: 4
|
89
|
+
summary: Yet Another Logger (YAL), logs debug and info messages using a simple UDPSocket
|
90
|
+
and more.
|
91
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|