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:
parent
863f48be8c
commit
ac77538544
|
@ -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
|
||||
]
|
||||
|
|
Reference in New Issue