1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Add a widget to display the log file in reverse order

This commit is contained in:
Chris Cummer
2018-06-16 14:04:48 -07:00
parent 6086690be7
commit 0fc2376179
3 changed files with 115 additions and 28 deletions

View File

@@ -1,26 +0,0 @@
package wtf
import (
"log"
"os"
"path/filepath"
)
//Log basic message logging, defaults to ~/.wtf/log.txt
func Log(message string) {
dir, err := Home()
if err != nil {
return
}
logfile := filepath.Join(dir, ".wtf", "log.txt")
f, err := os.OpenFile(logfile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
log.Fatalf("error opening file: %v", err)
}
defer f.Close()
log.SetOutput(f)
log.Println(message)
}