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