wamp_client 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/wamp/client.rb +3 -20
- data/lib/wamp/client/logging.rb +46 -0
- data/lib/wamp/client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6af897a4b27192f6199baed427630045313a6ae2
|
4
|
+
data.tar.gz: ae516cf28afd0385d7f583eee30747eb3a29a532
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32f33811288935d879e4eadf2ed00a1c83378835b9f71db6d4b7fada229876941e0b68b4e8b1adc59a3f1643b96aa6fe9ffc3d54a6f4a9798a73e7c9b8ebf7d5
|
7
|
+
data.tar.gz: f2b7adf5a18befc31bafa610202c9d20d6942c44303cffba027f0495798e52dd162a49669cd8fabbe366af7307b5e88c28ba44eff7cd3a661e95ff063cc21230
|
data/README.md
CHANGED
data/lib/wamp/client.rb
CHANGED
@@ -5,7 +5,7 @@ require 'wamp/client/connection'
|
|
5
5
|
require 'wamp/client/session'
|
6
6
|
require 'wamp/client/auth'
|
7
7
|
require 'wamp/client/response'
|
8
|
-
require '
|
8
|
+
require 'wamp/client/logging'
|
9
9
|
|
10
10
|
module Wamp
|
11
11
|
module Client
|
@@ -13,31 +13,14 @@ module Wamp
|
|
13
13
|
# Returns the logger object
|
14
14
|
#
|
15
15
|
def self.logger
|
16
|
-
|
17
|
-
@logger = Logger.new(STDOUT)
|
18
|
-
@logger.level = Logger::INFO
|
19
|
-
end
|
20
|
-
@logger
|
16
|
+
Logging.logger
|
21
17
|
end
|
22
18
|
|
23
19
|
# Sets the log level
|
24
20
|
#
|
25
21
|
# @param log_level [Symbol] - the desired log level
|
26
22
|
def self.log_level=(log_level)
|
27
|
-
|
28
|
-
case log_level
|
29
|
-
when :error
|
30
|
-
Logger::ERROR
|
31
|
-
when :debug
|
32
|
-
Logger::DEBUG
|
33
|
-
when :fatal
|
34
|
-
Logger::FATAL
|
35
|
-
when :warn
|
36
|
-
Logger::WARN
|
37
|
-
else
|
38
|
-
Logger::INFO
|
39
|
-
end
|
40
|
-
self.logger.level = level
|
23
|
+
Logging.log_level = log_level
|
41
24
|
end
|
42
25
|
|
43
26
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
module Wamp
|
4
|
+
module Client
|
5
|
+
module Logging
|
6
|
+
|
7
|
+
LOG_LEVEL_LOOKUP = {
|
8
|
+
error: Logger::ERROR,
|
9
|
+
debug: Logger::DEBUG,
|
10
|
+
info: Logger::INFO,
|
11
|
+
warn: Logger::WARN,
|
12
|
+
}
|
13
|
+
|
14
|
+
class Pretty < Logger::Formatter
|
15
|
+
def call(severity, time, program_name, message)
|
16
|
+
"#{time.utc.iso8601(3)} #{::Process.pid} #{severity[0]}: #{message}\n"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class WithoutTimestamp < Pretty
|
21
|
+
def call(severity, time, program_name, message)
|
22
|
+
"#{::Process.pid} #{severity[0]}: #{message}\n"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Returns the logger object
|
27
|
+
#
|
28
|
+
def self.logger
|
29
|
+
unless defined?(@logger)
|
30
|
+
$stdout.sync = true unless ENV['RAILS_ENV'] == "production"
|
31
|
+
@logger = Logger.new $stdout
|
32
|
+
@logger.level = Logger::INFO
|
33
|
+
@logger.formatter = ENV['DYNO'] ? WithoutTimestamp.new : Pretty.new
|
34
|
+
end
|
35
|
+
@logger
|
36
|
+
end
|
37
|
+
|
38
|
+
# Sets the log level
|
39
|
+
#
|
40
|
+
# @param log_level [Symbol] - the desired log level
|
41
|
+
def self.log_level=(log_level)
|
42
|
+
self.logger.level = LOG_LEVEL_LOOKUP[log_level.to_sym] || :info
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/wamp/client/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wamp_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Chapman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- lib/wamp/client/check.rb
|
156
156
|
- lib/wamp/client/connection.rb
|
157
157
|
- lib/wamp/client/event.rb
|
158
|
+
- lib/wamp/client/logging.rb
|
158
159
|
- lib/wamp/client/manager/base.rb
|
159
160
|
- lib/wamp/client/manager/base_multiple.rb
|
160
161
|
- lib/wamp/client/manager/establish.rb
|