diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-04-11 13:52:27 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-04-11 13:54:24 +0200 |
commit | 5e0ad75d174a69f082654c7fbb404fe849d658db (patch) | |
tree | bace208a553c2f994a944d7c0c25d53b211c3b7b | |
parent | f4847e4ed8a19bca842217db4919a0ef6eca92d4 (diff) |
syslog: Keep the name of the syslog around
We need to keep the pointer around and we place it in the
Smalltalk dictionary.
-rw-r--r-- | LogSyslog.st | 15 | ||||
-rw-r--r-- | LogTest.st | 12 |
2 files changed, 25 insertions, 2 deletions
diff --git a/LogSyslog.st b/LogSyslog.st index ab8ee60..3864265 100644 --- a/LogSyslog.st +++ b/LogSyslog.st @@ -38,14 +38,22 @@ LogTarget subclass: LogTargetSyslog [ ] LogTargetSyslog class >> openlog: aIdent option: aOption facility: aFacility [ + "Free any previous string" + SYSLOG_NAME ifNotNil: [ + SYSLOG_NAME free. + Smalltalk at: #SYSLOG_NAME put: nil. + ]. + + Smalltalk at: #SYSLOG_NAME put: aIdent asCData. + self c_closelog. - self c_openlog: aIdent opt: aOption facility: aFacility. + self c_openlog: SYSLOG_NAME opt: aOption facility: aFacility. ^ self new ] LogTargetSyslog class >> c_openlog: ident opt: aOpt facility: aFac [ <category: 'c-interface'> - <cCall: 'openlog' returning: #void args: #(#string #int #int)> + <cCall: 'openlog' returning: #void args: #(#cObject #int #int)> ] LogTargetSyslog class >> c_syslog: prio fmt: aFormat args: args[ @@ -78,3 +86,6 @@ LogTarget subclass: LogTargetSyslog [ ] ] +Eval [ + LogTargetSyslog initialize. +] @@ -39,4 +39,16 @@ Eval [ '123' logDebug: 'TEST' area: #sccp. '123' logException: 'TEST' area: #sccp. + + + "SYSLOG" + Object logManager target: + (Osmo.LogTargetSyslog + openlog: 'ow' option: 0 facility: Osmo.LogTargetSyslog LOG_USER). + '123' logException: 'ABC' area: #sccp. + + Object logManager target: + (Osmo.LogTargetSyslog + openlog: 'ow2' option: 0 facility: Osmo.LogTargetSyslog LOG_USER). + '123' logException: 'ABC' area: #sccp. ] |