Logging: Set Prefix



examples/logging-set-prefix/logging_set_prefix.go
package main

import (
    "log"
)

func main() {
    log.SetPrefix("Foo ")
    log.Print("First")
    log.Print("Second")
    log.SetPrefix("Bar ")
    log.Print("Third")
}

examples/logging-set-prefix/logging_set_prefix.out
Foo 2020/04/10 09:33:40 First
Foo 2020/04/10 09:33:40 Second
Bar 2020/04/10 09:33:40 Third