-
Beta Was this translation helpful? Give feedback.
Answered by
gucio321
Feb 1, 2024
Replies: 1 comment 1 reply
-
IDK if you can enable this anyhow, but you can easily implement that mechanism. Here is the code: package main
import (
"io"
"log"
"os"
"github.com/AllenDang/giu"
)
var giuLogger = &GiuLogger{}
var _ io.Writer = &GiuLogger{}
type GiuLogger struct {
buffer string
}
func (g *GiuLogger) Write(p []byte) (int, error) {
g.buffer = string(p) + g.buffer
return os.Stdout.Write(p)
}
func loop() {
giu.SingleWindow().Layout(
giu.Row(
giu.Button("Log message 1").OnClick(func() {
log.Print("[INFO] HI!!!")
}),
giu.Button("Log message 2").OnClick(func() {
log.Print("[ERROR] THIS is a log example!")
}),
),
giu.InputTextMultiline(&giuLogger.buffer).Flags(giu.InputTextFlagsReadOnly),
)
}
func main() {
log.SetOutput(giuLogger)
wnd := giu.NewMasterWindow("Log!", 640, 480, 0)
wnd.Run(loop)
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
viduq
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
IDK if you can enable this anyhow, but you can easily implement that mechanism. Here is the code: