Standard library / log
log.SetFlags()
Replace the formatting bitmask. Expected stdout: 'hello\n'.
Formal Syntax & Structure
go syntaxgo
func SetFlags(flag int)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| flag | int | Bitmask of formatting flags. |
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.SetFlags(0) log.Print("hello") fmt.Print(b.String())}