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:
parent
f4847e4ed8
commit
5e0ad75d17
15
LogSyslog.st
15
LogSyslog.st
|
@ -38,14 +38,22 @@ LogTarget subclass: LogTargetSyslog [
|
||||||
]
|
]
|
||||||
|
|
||||||
LogTargetSyslog class >> openlog: aIdent option: aOption facility: aFacility [
|
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_closelog.
|
||||||
self c_openlog: aIdent opt: aOption facility: aFacility.
|
self c_openlog: SYSLOG_NAME opt: aOption facility: aFacility.
|
||||||
^ self new
|
^ self new
|
||||||
]
|
]
|
||||||
|
|
||||||
LogTargetSyslog class >> c_openlog: ident opt: aOpt facility: aFac [
|
LogTargetSyslog class >> c_openlog: ident opt: aOpt facility: aFac [
|
||||||
<category: 'c-interface'>
|
<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[
|
LogTargetSyslog class >> c_syslog: prio fmt: aFormat args: args[
|
||||||
|
@ -78,3 +86,6 @@ LogTarget subclass: LogTargetSyslog [
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Eval [
|
||||||
|
LogTargetSyslog initialize.
|
||||||
|
]
|
||||||
|
|
12
LogTest.st
12
LogTest.st
|
@ -39,4 +39,16 @@ Eval [
|
||||||
'123' logDebug: 'TEST' area: #sccp.
|
'123' logDebug: 'TEST' area: #sccp.
|
||||||
|
|
||||||
'123' logException: '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.
|
||||||
]
|
]
|
||||||
|
|
Reference in New Issue