Feature #5096
closedoffer Logger-compatibility for syslog ext
Added by normalperson (Eric Wong) over 14 years ago. Updated over 13 years ago.
Description
There's http://rubygems.org/gems/SyslogLogger, but I would like to have
ths compatibility by default. Having to remember to install the
oddly-capitalized SyslogLogger gem makes things harder than it should
be.
Importing the SyslogLogger gem would solve this issue.
Files
| sysloglogger.patch (19.6 KB) sysloglogger.patch | tenderlovemaking (Aaron Patterson), 03/09/2012 07:24 AM | ||
| syslog.logger.patch (20.2 KB) syslog.logger.patch | rails-free patch | drbrain (Eric Hodel), 05/16/2012 09:59 AM | |
| knu-syslog_logger.patch.txt (5.67 KB) knu-syslog_logger.patch.txt | knu (Akinori MUSHA), 05/17/2012 09:59 PM |
Updated by normalperson (Eric Wong) over 14 years ago
Actions
#1
[ruby-core:38504]
Bah, I submitted the bug before I finished typing :<
Title should be: "offer Logger-compatibility for syslog ext"
Priority should be: Low
There's http://rubygems.org/gems/SyslogLogger, but I would like to have
ths compatibility by default. Having to remember to install the
oddly-capitalized SyslogLogger gem makes things harder than it should
be.
Importing the SyslogLogger gem would solve this issue.
Updated by nahi (Hiroshi Nakamura) over 14 years ago
Actions
#2
[ruby-core:38505]
- Subject changed from offer Logger-compatibility for ext to offer Logger-compatibility for syslog ext
- Priority changed from Normal to 3
Updated by drbrain (Eric Hodel) over 14 years ago
Actions
#3
[ruby-core:38507]
I would be happy to import my SyslogLogger gem, but I need someone to decide if it is ok first.
Updated by naruse (Yui NARUSE) over 14 years ago
Actions
#4
[ruby-core:38517]
Where is a patch or the repository?
Anyway such enhancement should be introduced as a patch to trunk.
We are hard to understand the actual change of this feature.
Moreover adding a new library or replacing a library is hard to accepted.
Enhance a existed library is much easier then it.
Updated by drbrain (Eric Hodel) over 13 years ago
Actions
#5
[ruby-core:43105]
- Assignee set to drbrain (Eric Hodel)
The repository is here: https://github.com/seattlerb/sysloglogger
I will attach a patch to this issue soon.
Updated by tenderlovemaking (Aaron Patterson) over 13 years ago
Actions
#6
[ruby-core:43143]
- File sysloglogger.patch sysloglogger.patch added
I've attached a patch. It imports sysloglogger as Syslog::Logger. Syslog::Logger is a logger that logs to Syslog, but has the same API as Logger.
Updated by drbrain (Eric Hodel) over 13 years ago
Actions
#7
[ruby-core:43144]
I think the implementation is fine, but the Syslog::Logger constant should be updated since the name was changed.
Also, should the rails references be removed or changed?
Updated by drbrain (Eric Hodel) over 13 years ago
Actions
#8
[ruby-core:43145]
Ugh, I meant "Syslog::Logger comment"
Updated by shyouhei (Shyouhei Urabe) over 13 years ago
Actions
#9
- Status changed from Open to Assigned
Updated by drbrain (Eric Hodel) over 13 years ago
Actions
#10
[ruby-core:45069]
- File syslog.logger.patch syslog.logger.patch added
This updated patch removes references to rails and the silence method (as it is not thread-safe).
Updated by knu (Akinori MUSHA) over 13 years ago
Actions
#11
[ruby-core:45071]
- Assignee changed from drbrain (Eric Hodel) to knu (Akinori MUSHA)
I'll look into this shortly.
I think I'm going to put this under ext/syslog/lib/syslog/ so the whole syslog library can be made a gem in the future.
Updated by drbrain (Eric Hodel) over 13 years ago
Actions
#12
[ruby-core:45072]
The second rails-free patch places it under ext/syslog/lib/syslog and introduces test/syslog/.
I did not move test/test_syslog.rb to test/syslog/test_syslog.rb though, I was going to submit this as a separate issue if this was was accepted.
Updated by knu (Akinori MUSHA) over 13 years ago
Actions
#13
[ruby-core:45096]
Oh, of course. I didn't carefully read the latest patch.
I've revised the implementation and the tests as attached.
Here's the list of what I changed:
-
Reduced map constants. You shouldn't need this many.
-
Changed Syslog::Logger::SYSLOG to Syslog::Logger.syslog using a class variable as storage. I didn't like the way the constant was used.
-
Changed to call syslog methods with ('%s', message) instead of manually replacing %'s.
-
Changed a regexp so it exactly matches (ANSI & XTerm) color escape sequences.
Please merge it if it's OK, and you have my approval.
Updated by drbrain (Eric Hodel) over 13 years ago
Actions
#14
[ruby-core:45097]
I think you forgot to attach the patch.
Your changes sound good, thank you for the review and update on my very (5 year) old code.
Updated by knu (Akinori MUSHA) over 13 years ago
Actions
#15
[ruby-core:45108]
Updated by knu (Akinori MUSHA) over 13 years ago
Actions
#16
[ruby-core:45109]
D'oh, here it is.
Updated by drbrain (Eric Hodel) over 13 years ago
Actions
#17
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r35682.
Eric, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- ext/syslog/lib/syslog/logger.rb: Added Syslog::Logger which was
ported from the SyslogLogger gem. [ruby-trunk - Feature #5096] - NEWS: ditto.
- test/syslog/test_syslog_logger.rb: ditto.