Move the policy about the areas into the LogManager
This commit is contained in:
parent
d16a9da541
commit
5dc9296b36
|
@ -154,10 +154,48 @@ Object subclass: LogArea [
|
|||
]
|
||||
|
||||
Object subclass: LogTarget [
|
||||
| areas |
|
||||
<category: 'osmo-logging-core'>
|
||||
<comment: 'I will filter and then output the log message'>
|
||||
|
||||
|
||||
print: anEntry [
|
||||
<category: 'log'>
|
||||
self subclassResponsibility.
|
||||
]
|
||||
]
|
||||
|
||||
LogTarget subclass: LogTranscriptTarget [
|
||||
<category: 'osmo-logging-target'>
|
||||
<comment: 'I log to the Transcript buffer'>
|
||||
|
||||
print: anEntry [
|
||||
<category: 'log'>
|
||||
Transcript show: anEntry msg; nl.
|
||||
]
|
||||
]
|
||||
|
||||
Object subclass: LogManager [
|
||||
| target areas |
|
||||
<category: 'osmo-logging-core'>
|
||||
<comment: 'I handle the actual log invocation'>
|
||||
|
||||
Log := nil.
|
||||
|
||||
LogManager class >> default [
|
||||
<category: 'instance'>
|
||||
Log ifNil: [
|
||||
Log := LogManager new.
|
||||
Log target: LogTranscriptTarget new.
|
||||
].
|
||||
|
||||
^ Log
|
||||
]
|
||||
|
||||
target: aTarget [
|
||||
<category: 'private'>
|
||||
target := aTarget.
|
||||
]
|
||||
|
||||
areas [
|
||||
<category: 'accessing'>
|
||||
areas ifNil: [
|
||||
|
@ -193,48 +231,7 @@ Object subclass: LogTarget [
|
|||
log: anEntry [
|
||||
<category: 'log'>
|
||||
self handle: anEntry ifTrue: [
|
||||
self print: anEntry.
|
||||
target print: anEntry
|
||||
]
|
||||
]
|
||||
|
||||
print: anEntry [
|
||||
<category: 'log'>
|
||||
self subclassResponsibility.
|
||||
]
|
||||
]
|
||||
|
||||
LogTarget subclass: LogTranscriptTarget [
|
||||
<category: 'osmo-logging-target'>
|
||||
<comment: 'I log to the Transcript buffer'>
|
||||
|
||||
print: anEntry [
|
||||
<category: 'log'>
|
||||
Transcript show: anEntry msg; nl.
|
||||
]
|
||||
]
|
||||
|
||||
Object subclass: LogManager [
|
||||
| target |
|
||||
<category: 'osmo-logging-core'>
|
||||
<comment: 'I handle the actual log invocation'>
|
||||
|
||||
Log := nil.
|
||||
|
||||
LogManager class >> default [
|
||||
<category: 'instance'>
|
||||
Log ifNil: [
|
||||
Log := LogManager new.
|
||||
Log target: LogTranscriptTarget new.
|
||||
].
|
||||
|
||||
^ Log
|
||||
]
|
||||
|
||||
log: anEntry [
|
||||
target log: anEntry.
|
||||
]
|
||||
|
||||
target: aTarget [
|
||||
target := aTarget.
|
||||
]
|
||||
]
|
||||
|
|
Reference in New Issue