This is a creation in Article, where the information may have evolved or changed.
Go Language Log output
Bits or ' Ed together to control what's printed.//there is no control over the order they appear (the order listed//her e) or the format they present (as described in the comments).//The prefix is followed by a colon if llongfile or L shortfile//is specified.//For example, Flags Ldate | Ltime (or lstdflags) produce,//2009/01/23 01:23:23 message//while flags Ldate | Ltime | Lmicroseconds | Llongfile produce,//2009/01/23 01:23:23.123123/a/b/c/d.go:23:messageldate = 1 << iota//the date in The local time Zone:2009/01/23ltime//The time in the local time zone:01:23:23lmicroseconds Microsecond resolution:01:23:23.123123. Assumes Ltime.llongfile//full file name and line number:/a/b/c/d.go:23lshortfile Final file name element and line number:d.go:23. Overrides LLONGFILELUTC//if Ldate or Ltime is set, use UTC rather than the local time zoneLstdflags = Ldate | Ltime//Initial values for the standard logger
Ldate//Date: 2009/01/23
Ltime//Time: 01:23:23
Lmicroseconds//microseconds: 01:23:23.123123.
Llongfile//path + file name + line number:/a/b/c/d.go:23
Lshortfile//filename + line number: d.go:23
LUTC//using the standard UTC time Format
Lstdflags = Ldate | Ltime//default
Set Default:
log.SetFlags(log.LstdFlags)
Set the date, time, file name + line number (print error message, easier to locate the error point, problem location is useful)
log.SetFlags(log.LstdFlags | Lshortfile)