mlserver 1.0.1 → 1.0.2
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/bin/mlserver +19 -1
- data/lib/MLserver/logger.rb +10 -4
- data/lib/MLserver.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86fe66bb2ece6aa1aeb92f25f69b88d266f8743bf9b931aa40bfdd1a22945fba
|
4
|
+
data.tar.gz: f1a46e419ab1b5474006064c28593a14f1f741bc6bdfd95fa68463bb45507346
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e0813a7844e61e75e1fb5bc95271bed3c1f7af903055aa16e8293d0c588669e67c172f05810d3dd7b74d1ca49351a771ef34877b88c2eddb78066aca3166bb9
|
7
|
+
data.tar.gz: 39c3f002aa07a6fd5e36e69748b1a0432d3d6bf7e9d438efd0ff977660d40c4bb6ce4322e8014d05dcd2df01d8bea99390412ec4358edfb1c2e1e522426c94ef
|
data/bin/mlserver
CHANGED
@@ -11,6 +11,24 @@ s = {}
|
|
11
11
|
x = ArgsParser::Args.new(options: o, switches: s)
|
12
12
|
|
13
13
|
conf_file = x.data[0]
|
14
|
-
|
14
|
+
|
15
|
+
if !conf_file
|
16
|
+
conf_file = "mlserver.conf.rb"
|
17
|
+
end
|
18
|
+
|
19
|
+
if File.directory?(conf_file)
|
20
|
+
conf_file = "#{conf_file}/mlserver.conf.rb"
|
21
|
+
end
|
22
|
+
|
23
|
+
if !File.exist?(conf_file)
|
24
|
+
STDERR.puts "Error: Conf file does not exist"
|
25
|
+
exit 1
|
26
|
+
end
|
27
|
+
|
28
|
+
full_conf_file_path = File.expand_path(conf_file, Dir.pwd)
|
29
|
+
|
30
|
+
Dir.chdir(File.dirname full_conf_file_path)
|
31
|
+
|
32
|
+
require full_conf_file_path
|
15
33
|
|
16
34
|
MLserver::Server.start()
|
data/lib/MLserver/logger.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
module MLserver
|
2
2
|
class Logger
|
3
|
-
@@log_levels = [:info, :warn, :error]
|
3
|
+
@@log_levels = [:info, :warn, :error, :traffic_in, :traffic_out]
|
4
4
|
|
5
|
-
def initialize(out:, err:, log_colors: {}, outputs: {error: :err})
|
5
|
+
def initialize(out:, err:, log_colors: {}, outputs: {error: :err}, levels_with_timestamp: [:traffic_in, :traffic_out])
|
6
6
|
@out = out
|
7
7
|
@err = err
|
8
8
|
@log_colors = log_colors
|
9
9
|
@outputs = outputs
|
10
|
+
@levels_with_timestamp = levels_with_timestamp
|
10
11
|
end
|
11
12
|
|
12
13
|
def log(message, level = :info)
|
@@ -16,6 +17,9 @@ module MLserver
|
|
16
17
|
if @log_colors[level]
|
17
18
|
message = message.color @log_colors[level]
|
18
19
|
end
|
20
|
+
|
21
|
+
message = "#{Time.now} | #{message}" if @levels_with_timestamp.include?(level)
|
22
|
+
|
19
23
|
out.puts message
|
20
24
|
end
|
21
25
|
|
@@ -38,13 +42,15 @@ module MLserver
|
|
38
42
|
def log_traffic(ip, direction, data)
|
39
43
|
symbol = (direction == :incoming ? "=>" : "<=")
|
40
44
|
|
41
|
-
log("#{format_ip_address ip} #{symbol} #{data}")
|
45
|
+
log("#{format_ip_address ip} #{symbol} #{data}", (direction == :incoming ? :traffic_in : :traffic_out))
|
42
46
|
end
|
43
47
|
end
|
44
48
|
|
45
49
|
dlcolors = {
|
46
50
|
warn: :yellow,
|
47
|
-
error: :red
|
51
|
+
error: :red,
|
52
|
+
traffic_in: :green,
|
53
|
+
traffic_out: :blue
|
48
54
|
}
|
49
55
|
|
50
56
|
DefaultLogger = Logger.new(out: STDOUT, err: STDERR, log_colors: dlcolors)
|
data/lib/MLserver.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mlserver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthias Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: argparse
|