lines 0.1.24 → 0.1.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTJhOWYwNjQ0Y2MwNzlmMThkY2U4ODAzMmFmZjA2NTE2NDU3Zjc0OQ==
4
+ YTI4MDczNmE2NTQ0NzYxNjk4MWI0ZDI1OTNjNzYxMDJmMDc2YTNhYg==
5
5
  data.tar.gz: !binary |-
6
- NmYxNzcxNzY0YmUyOTFhNWUyNzZkZDBkYmMzYmFiZjJlMTY4YmM5Zg==
6
+ NDc0YmRiNWU2ZDczNDIzZTg4NDlmZjE3NjVkZmU0ZGQ0MzA5MjJjOA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OGE3NWJhNTkyNzU4ZjI5OTY3ODhlZDRjYWYzOTczYTlhMjhhOTM2NjAxMWY0
10
- MWZiOTc2NDIyNzc2ZGIwZGNlOTg0YTcxNjNhNjk2ZDc5N2MwOGE4MDhiMjhj
11
- OWE2N2FiNDQ1YzdlNjhhNTkzNmViNWE4MmE3ZjhkMTdiNzM3NzI=
9
+ NzhmMjY0NGVjOWYyZWEzNzM4NjMyMzYxZDVlOTExNTVlZjkyYjBmNGZkNjky
10
+ OWYzZmVmOWJjNTcxNGI3NDg3NWJkYTk5MDk1ZTEyNjlkMWRjMGYzODA4MWI5
11
+ Y2UwM2NmOGY1Mzk4Y2UwNzBiNWNlMWFlNDAwY2QwNmM3OGM3Mzg=
12
12
  data.tar.gz: !binary |-
13
- ODIzOWMzZDQ3Y2Y1MDk2NWRmYzUyNDExZjU0YzA2YTIyNTQ3ZjIzYTc2Mzgw
14
- ZTYxZjBiZDZkMjJjMDE3MzIzZDZlYTIyMzA5YjA2Y2YwNmMyMDM3N2NiZjA0
15
- NGUzZjQwYTgxOTlmY2I1ZTQ3OTdlM2QwYmQ1ZDY2NzNkZTgxMjk=
13
+ NzdiM2Y1NjJmZGMwY2YzNzNmNTkxMWYwZTNkNWU0NDVmNzJmY2Y4ODViNjNj
14
+ MWUwZjU2NGY0ZmY3MjY4OGU1M2ViNGMwODk3NzQ0YmRkZWFjMjk3MWUyYTk1
15
+ N2ZjYTJhMDIwZGQ3ZmNkZDU1OWNhMzNkYzM0OWQ0Zjk5NjY0OWY=
@@ -1,17 +1,24 @@
1
1
 
2
+ 0.1.25 / 2013-07-10 : the "hopefully all syslog issues are fixes" edition
3
+ ===================
4
+
5
+ * Change the logic of opening syslog with the app_name.
6
+ * Fixes syslog level extraction
7
+ * Fixes incorrect flag masks when opening syslog
8
+
2
9
  0.1.24 / 2013-07-09
3
- ==================
10
+ ===================
4
11
 
5
12
  * Fixes escaping issue with Syslog
6
13
 
7
14
  0.1.22 / 2013-06-27
8
- ==================
15
+ ===================
9
16
 
10
17
  * Fixes issue where Syslog is not recognized as an outputter
11
18
  * Fixes issue when Lines.use is given an array of outputters
12
19
 
13
20
  0.1.21 / 2013-06-27
14
- ==================
21
+ ===================
15
22
 
16
23
  * Return self when silencing the Rack::CommonLogger
17
24
  * Use Lines as the default ActiveRecord::Base logger
@@ -152,22 +152,23 @@ module Lines
152
152
  require 'syslog'
153
153
  class SyslogOutputter
154
154
  PRI2SYSLOG = {
155
- debug: Syslog::LOG_DEBUG,
156
- info: Syslog::LOG_INFO,
157
- warn: Syslog::LOG_WARNING,
158
- warning: Syslog::LOG_WARNING,
159
- err: Syslog::LOG_ERR,
160
- error: Syslog::LOG_ERR,
161
- crit: Syslog::LOG_CRIT,
162
- critical: Syslog::LOG_CRIT,
155
+ 'debug' => Syslog::LOG_DEBUG,
156
+ 'info' => Syslog::LOG_INFO,
157
+ 'warn' => Syslog::LOG_WARNING,
158
+ 'warning' => Syslog::LOG_WARNING,
159
+ 'err' => Syslog::LOG_ERR,
160
+ 'error' => Syslog::LOG_ERR,
161
+ 'crit' => Syslog::LOG_CRIT,
162
+ 'critical' => Syslog::LOG_CRIT,
163
163
  }
164
164
 
165
- def initialize(syslog = Syslog, app_name=nil)
165
+ def initialize(syslog = Syslog)
166
166
  @syslog = syslog
167
- prepare_syslog(app_name)
168
167
  end
169
168
 
170
169
  def output(dumper, obj)
170
+ prepare_syslog obj[:app]
171
+
171
172
  obj = obj.dup
172
173
  obj.delete(:pid) # It's going to be part of the message
173
174
  obj.delete(:at) # Also part of the message
@@ -176,25 +177,22 @@ module Lines
176
177
  level = extract_pri(obj)
177
178
  str = dumper.dump(obj)
178
179
 
179
- syslog.log(level, "%s", str)
180
+ @syslog.log(level, "%s", str)
180
181
  end
181
182
 
182
183
  protected
183
184
 
184
- attr_reader :syslog
185
-
186
185
  def prepare_syslog(app_name)
187
- unless syslog.opened?
188
- # Did you know ? app_name is detected by syslog if nil
189
- syslog.open(app_name,
190
- Syslog::LOG_PID & Syslog::LOG_CONS & Syslog::LOG_NDELAY,
191
- Syslog::LOG_USER)
192
- end
186
+ return if @syslog.opened?
187
+ app_name ||= File.basename($0)
188
+ @syslog.open(app_name,
189
+ Syslog::LOG_PID | Syslog::LOG_CONS | Syslog::LOG_NDELAY,
190
+ Syslog::LOG_USER)
193
191
  end
194
192
 
195
193
  def extract_pri(h)
196
194
  pri = h.delete(:pri).to_s.downcase
197
- PRI2SYSLOG[pri] || PRI2SYSLOG[:info]
195
+ PRI2SYSLOG[pri] || Syslog::LOG_INFO
198
196
  end
199
197
  end
200
198
 
@@ -1,3 +1,3 @@
1
1
  module Lines
2
- VERSION = "0.1.24"
2
+ VERSION = "0.1.25"
3
3
  end
@@ -53,3 +53,4 @@ end
53
53
  bm "real file logger" do
54
54
  Lines.logger.info "Ahoi this is a really cool option"
55
55
  end
56
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lines
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.24
4
+ version: 0.1.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Pfenniger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-09 00:00:00.000000000 Z
11
+ date: 2013-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler