hpfeeds 0.1.1 → 0.1.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/CHANGELOG.md +6 -2
- data/README.md +12 -0
- data/lib/hpfeeds/client.rb +17 -3
- data/lib/hpfeeds/version.rb +1 -1
- data/lib/hpfeeds/version.rb~ +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1bd654109dcee1eaf2deb278fe4711f83e26108
|
4
|
+
data.tar.gz: 62a3c061bb49aa28e0a16dbd3890c7db6afde2f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 251cd8a93db0ffa7ccf06351e7565e6668d88bab47165fb4f796bd8ce48c779ff53d6de73f3bed7f4e8da397c7531afb0e1b637dba36163afee7e05401e87c7a
|
7
|
+
data.tar.gz: 6ba3f86460c17470cec02ef40920a7e19c2ae45909672459e26b966c724c77ff50e4cc04587a6401cc3a690e155f86a3b8489a25ee5da0db6854fc3e41d84798
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
+
#### 0.1.2
|
2
|
+
- major changes:
|
3
|
+
- added log_to and log_level options to HPFeeds::Client constructor
|
4
|
+
|
1
5
|
#### 0.1.1
|
2
|
-
- major
|
6
|
+
- major changes:
|
3
7
|
- separate handlers for messages from different chanels
|
4
8
|
- better error messages handling
|
5
9
|
|
6
|
-
- minor
|
10
|
+
- minor changes:
|
7
11
|
- documentation, indentation
|
8
12
|
|
9
13
|
#### 0.1.0
|
data/README.md
CHANGED
@@ -71,6 +71,18 @@ The argument in
|
|
71
71
|
is an handler for HPFeeds error messages (i.e. `'accessfail'` or `'authfail'`).
|
72
72
|
It's optional: if you don't provide any handler, an exception will be raised (`HPFeeds::ErrorMessage`) in case of error messages.
|
73
73
|
|
74
|
+
### Logging
|
75
|
+
It's possibile to specify a path for log file (default is stdout) and a log level, as follows
|
76
|
+
```ruby
|
77
|
+
@hp = HPFeeds::Client.new ({
|
78
|
+
host: hpfeeds_server_name_here,
|
79
|
+
port: hpfeeds_port_number_here, # default is 10000
|
80
|
+
ident: 'XXXXXX',
|
81
|
+
secret: '123456',
|
82
|
+
log_to: path_to_log_file, # default is STDOUT
|
83
|
+
log_level: :debug # default is info
|
84
|
+
})
|
85
|
+
```
|
74
86
|
## Contributing
|
75
87
|
|
76
88
|
1. Fork it
|
data/lib/hpfeeds/client.rb
CHANGED
@@ -25,10 +25,11 @@ module HPFeeds
|
|
25
25
|
@connected = false
|
26
26
|
@stopped = false
|
27
27
|
|
28
|
-
|
29
|
-
@logger = Logger.new(
|
30
|
-
@logger.level =
|
28
|
+
log_to = options[:log_to] || STDOUT
|
29
|
+
@logger = Logger.new(log_to)
|
30
|
+
@logger.level = get_log_level(options[:log_level])
|
31
31
|
|
32
|
+
@decoder = Decoder.new
|
32
33
|
@handlers = {}
|
33
34
|
|
34
35
|
tryconnect
|
@@ -163,5 +164,18 @@ module HPFeeds
|
|
163
164
|
end
|
164
165
|
end
|
165
166
|
|
167
|
+
def get_log_level(level)
|
168
|
+
return Logger::INFO if level.nil?
|
169
|
+
case level.to_s.downcase
|
170
|
+
when 'debug'; Logger::DEBUG
|
171
|
+
when 'info'; Logger::INFO
|
172
|
+
when 'warn'; Logger::WARN
|
173
|
+
when 'warning'; Logger::WARN
|
174
|
+
when 'error'; Logger::ERROR
|
175
|
+
when 'fatal'; Logger::FATAL
|
176
|
+
else Logger::INFO
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
166
180
|
end
|
167
181
|
end
|
data/lib/hpfeeds/version.rb
CHANGED
data/lib/hpfeeds/version.rb~
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hpfeeds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francesco Coda Zabetta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|