enhancing logging. code broken

This commit is contained in:
2024-11-23 14:49:04 +09:00
parent afb3ad33af
commit 30f997d8e8
6 changed files with 74 additions and 68 deletions

View File

@ -14,14 +14,13 @@ const (
)
type Logger interface {
Write (level LogLevel, fmt string, args ...interface{})
Write (id string, level LogLevel, fmt string, args ...interface{})
}
type Service interface {
RunTask (wg *sync.WaitGroup) // blocking. run the actual task loop
RunTask (wg *sync.WaitGroup) // blocking. run the actual task loop. it must call wg.Done() upon exit from itself.
StartService(data interface{}) // non-blocking. spin up a service. it may be invokded multiple times for multiple instances
StopServices() // non-blocking. send stop request to all services spun up
WaitForTermination() // blocking. must wait until all services are stopped
WriteLog(id string, level LogLevel, fmt string, args ...interface{})
}
type ExtTask func(svc Service, wg *sync.WaitGroup)