5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 11:10:47 +08:00
wails/v3/pkg/logger/log.go
Lea Anthony 5dbda4aead
Feature: AssetServer Runtime (#2335)
* Tidy up runtime JS

* Initial implementation of runtime over http

* Update runtime deps. Fix test task.

* Support Clipboard.
Message Processor refactor.

* Add `Window.Screen()`
Clipboard `GetText` -> `Text`

* Support most dialogs
Better JS->Go object mapping
Implement Go->JS callback mechanism
Rename `window.runtime` -> `window.wails` to better reflect the Go API

* Support SaveFile dialog

* Remove go.work

* Tidy up

* Event->CustomEvent to prevent potential clash with native JS Event object
Support Eventing

* Support application calls

* Support logging

* Support named windows
Remove debug info

* Update v3 changes
2023-02-06 20:50:11 +11:00

36 lines
559 B
Go

package logger
import (
"fmt"
)
type Logger struct {
output []Output
}
func New(outputs ...Output) *Logger {
result := &Logger{}
if outputs != nil {
result.output = outputs
}
return result
}
func (l *Logger) AddOutput(output Output) {
l.output = append(l.output, output)
}
func (l *Logger) Log(message *Message) {
for _, o := range l.output {
go o.Log(message)
}
}
func (l *Logger) Flush() {
for _, o := range l.output {
if err := o.Flush(); err != nil {
fmt.Printf("Error flushing '%s' Logger: %s\n", o.Name(), err.Error())
}
}
}