1
0
mirror of https://github.com/mum4k/termdash.git synced 2025-04-28 13:48:51 +08:00

Updated Debugging (markdown)

Jakub Sobon 2020-11-21 19:41:36 -05:00
parent a9807c62ec
commit 3db07c7a56

@ -8,6 +8,23 @@ The `log` package has a function that allows redirection of all logged messages
https://godoc.org/log#SetOutput
Example:
```go
f, err := os.Create("debug.log")
if err != nil {
log.Fatal(err)
}
log.SetOutput(f)
```
Now we can add debug statement anywhere in the code like this:
```go
log.Printf("Debugging: %v", someVar)
```
The log messages will be written into a file named `debug.log`.
## Using the text widget.
`Termdash` comes with a `Text` widget which is capable of displaying any text messages. If your application allows it, consider including a separate `Text` widget in your layout and have it display any debug messages directly on the terminal.