1
0
Fork 0

syslog: Keep the name of the syslog around

We need to keep the pointer around and we place it in the
Smalltalk dictionary.
This commit is contained in:
Holger Hans Peter Freyther 2011-04-11 13:52:27 +02:00
parent f4847e4ed8
commit 5e0ad75d17
2 changed files with 25 additions and 2 deletions

View File

@ -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.
]

View File

@ -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.
]