...

Source file src/oss.terrastruct.com/util-go/cmdlog/example/main.go

Documentation: oss.terrastruct.com/util-go/cmdlog/example

     1  package main
     2  
     3  import (
     4  	"os"
     5  	"time"
     6  
     7  	"oss.terrastruct.com/util-go/cmdlog"
     8  	"oss.terrastruct.com/util-go/xos"
     9  )
    10  
    11  func main() {
    12  	l := cmdlog.New(xos.NewEnv(os.Environ()), os.Stderr)
    13  	l = l.WithCCPrefix("lochness")
    14  	l = l.WithCCPrefix("imgbundler")
    15  	l = l.WithCCPrefix("cache")
    16  
    17  	l.NoLevel.Println("Somehow, the world always affects you more than you affect it.")
    18  
    19  	l.SetDebug(true)
    20  	l.Debug.Println("Man is a rational animal who always loses his temper when he is called upon.")
    21  
    22  	l.SetDebug(false)
    23  	l.Debug.Println("You can never trust a woman; she may be true to you.")
    24  
    25  	l.SetTS(true)
    26  	l.Success.Println("An alcoholic is someone you don't like who drinks as much as you do.")
    27  	l.Info.Println("There once was this swami who lived above a delicatessan.")
    28  
    29  	l.SetTSFormat(time.UnixDate)
    30  	l.Warn.Println("Telephone books are like dictionaries -- if you know the answer before.")
    31  
    32  	l.SetTS(false)
    33  	l.Error.Println("Nothing can be done in one trip.")
    34  	l.Error.Println(`Good day to let down old friends who need help.
    35  I believe in getting into hot water; it keeps you clean.`)
    36  }
    37  

View as plain text