using args.Register()

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2023-12-29 17:24:39 -06:00
parent 5766e86595
commit 424a1b42e2
3 changed files with 40 additions and 0 deletions

22
args.go Normal file
View File

@ -0,0 +1,22 @@
package log
import (
arg "github.com/alexflint/go-arg"
)
//
// Attempt to switch logging to syslog on linux
//
var argLog ArgLog
// This struct can be used with the go-arg package
type ArgLog struct {
LogTmp bool `arg:"--log-tmp" help:"send all output /tmp"`
LogStdout bool `arg:"--log-stdout" help:"send all output to STDOUT"`
LogQuiet bool `arg:"--log-quiet" help:"suppress all output"`
}
func init() {
arg.Register(&argLog)
}

10
bool.go Normal file
View File

@ -0,0 +1,10 @@
package log
import (
golanglog "log"
)
func Bool(b bool, a ...any) {
if ! b {return}
golanglog.Println(a...)
}

8
log.go
View File

@ -7,3 +7,11 @@ import (
func Println(a ...any) {
origlog.Println(a...)
}
func Fatalf(s string, a ...any) {
origlog.Fatalf(s, a...)
}
func Fatal(s string, a ...any) {
origlog.Fatalf(s, a...)
}