log: Make it possible to log exceptions
This commit is contained in:
parent
0aba20a891
commit
bdaff7cef1
|
@ -51,6 +51,14 @@ Object extend [
|
|||
(self logManager)
|
||||
log: (LogEntry withMsg: aMessage level: LogLevel error area: anArea context: self)
|
||||
]
|
||||
|
||||
logException: aMessage area: anArea [
|
||||
<category: '*osmo-logging-exception'>
|
||||
(self logManager)
|
||||
exception: (LogEntry withMsg: aMessage
|
||||
level: LogLevel error
|
||||
area: anArea context: thisContext parentContext)
|
||||
]
|
||||
]
|
||||
|
||||
Object subclass: LogEntry [
|
||||
|
@ -191,6 +199,11 @@ Object subclass: LogTarget [
|
|||
<category: 'log'>
|
||||
self subclassResponsibility.
|
||||
]
|
||||
|
||||
exception: anEntry [
|
||||
<category: 'log'>
|
||||
self subclassResponsibility.
|
||||
]
|
||||
]
|
||||
|
||||
LogTarget subclass: LogTranscriptTarget [
|
||||
|
@ -201,6 +214,12 @@ LogTarget subclass: LogTranscriptTarget [
|
|||
<category: 'log'>
|
||||
Transcript show: anEntry msg; nl.
|
||||
]
|
||||
|
||||
exception: anEntry [
|
||||
<category: 'log'>
|
||||
Transcript show: anEntry msg; nl.
|
||||
anEntry context backtraceOn: Transcript.
|
||||
]
|
||||
]
|
||||
|
||||
Object subclass: LogFilter [
|
||||
|
@ -276,6 +295,13 @@ Object subclass: LogManager [
|
|||
]
|
||||
]
|
||||
|
||||
exception: anEntry [
|
||||
<category: 'log'>
|
||||
self handle: anEntry ifTrue: [
|
||||
target exception: anEntry.
|
||||
]
|
||||
]
|
||||
|
||||
context: aString value: aValue [
|
||||
| key |
|
||||
key := Array with: 'LogArea' with: aString.
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"
|
||||
|
||||
LogArea subclass: LogAreaSCCP [
|
||||
PackageLoader fileInPackage: #OsmoLogging.
|
||||
|
||||
Osmo.LogArea subclass: LogAreaSCCP [
|
||||
LogAreaSCCP class >> areaName [
|
||||
^ #sccp
|
||||
]
|
||||
|
@ -35,4 +37,6 @@ LogArea subclass: LogAreaSCCP [
|
|||
|
||||
Eval [
|
||||
'123' logDebug: 'TEST' area: #sccp.
|
||||
|
||||
'123' logException: 'TEST' area: #sccp.
|
||||
]
|
||||
|
|
Reference in New Issue