How to change Logger #151
-
I want use self Logger |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Thanks for the question. Golang has no Logger interface yet (they will probably add it soon golang/go#56345). Until then, there is no standard way to do that. What is the reason for having it in your program? |
Beta Was this translation helpful? Give feedback.
-
moving it to the discussion |
Beta Was this translation helpful? Give feedback.
-
the next version 3.0 will get a flexible logging subsystem. you will be able to add a custom logger or use the process as a logger. you will also be able to set the logging level for the node and the process individually. here is little example how it looks like func (a *MyActor) Init(args ...any) error {
...
a.Log().Info("starting with name - %s", a.Name())
a.Log().SetLevel(gen.LogLevelDebug)
return nil
}
...
pid, err := node.SpawnRegister("example", fabricMyActor, gen.ProcessOptions{})
node.Log().Info("started MyActor with PID %s", pid)
node.Log().SetLevel(gen.LogLevelDebug)
...
1686217717548243545 [info] <90A29F11.0.1001>: starting with name - 'example'
1686217717548282816 [info] 90A29F11: started MyActor with PID <90A29F11.0.1001> PS: its done now, just wait for the release |
Beta Was this translation helpful? Give feedback.
the next version 3.0 will get a flexible logging subsystem. you will be able to add a custom logger or use the process as a logger. you will also be able to set the logging level for the node and the process individually. here is little example how it looks like