Standard library / log
log.Prefix()
Return the active prefix. Expected stdout: 'app: \n'.
Formal Syntax & Structure
go syntaxgo
func Prefix() stringReturn Value
string
Return the active prefix.
Working Example
Example Snippetgo
package main
import ( "bytes" "fmt" "log")
func main() { var b bytes.Buffer log.SetOutput(&b) log.SetFlags(0) log.SetPrefix("") log.SetPrefix("app: ") fmt.Println(log.Prefix())}