Implement backend.Stdout that can be subscribed/unsubscribed.

This commit is contained in:
Kleissner
2022-01-06 04:11:28 +01:00
parent a19bac1916
commit 5c8b8eb94b
3 changed files with 51 additions and 1 deletions

View File

@@ -29,6 +29,7 @@ func Init(UserAgent string, ConfigFilename string, Filters *Filters) (backend *B
backend = &Backend{
ConfigFilename: ConfigFilename,
userAgent: UserAgent,
Stdout: newMultiWriter(),
}
if Filters != nil {
@@ -108,4 +109,7 @@ type Backend struct {
// peerMonitor is a list of channels receiving information about new peers
peerMonitor []chan<- *PeerInfo
// Stdout bundles any output for the end-user. Writers may subscribe/unsubscribe.
Stdout *multiWriter
}