1
0
Fork 0

Use the loglevel of the area.

Turn the log level into integers to be able to compare
them as such.
This commit is contained in:
Holger Hans Peter Freyther 2010-09-06 15:49:55 +08:00
parent 863f48be8c
commit ac77538544
1 changed files with 8 additions and 7 deletions

View File

@ -42,19 +42,19 @@ Object subclass: LogLevel [
<comment: 'I represent the available levels for log messages'>
LogLevel class >> debug [
^ #logDebug
^ 1
]
LogLevel class >> info [
^ #logInfo
^ 3
]
LogLevel class >> notice [
^ #logNotice
^ 5
]
LogLevel class >> error [
^ #logError
^ 7
]
]
@ -147,7 +147,7 @@ Object subclass: LogManager [
config := anObject logConfig.
area := config perform: anArea asSymbol.
area enabled
(area enabled and: [anLevel >= area minLevel])
ifTrue: [
Transcript show: message; nl.
].
@ -155,11 +155,12 @@ Object subclass: LogManager [
]
Eval [
area := LogArea withName: 'Base is for Base' enabled: true minLevel: LogLevel debug.
| area nothere |
area := LogArea withName: 'Base is for Base' enabled: true minLevel: LogLevel info.
nothere := LogArea withName: 'Base is for Base' enabled: false minLevel: LogLevel debug.
LogConfig default addArea: area name: #base.
LogConfig default addArea: nothere name: #nothere.
'123' logDebug: 'Log Message' area: #base.
'123' logInfo: 'Log Message' area: #base.
'456' logDebug: 'Log Foo' area: #nothere
]