You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"stdout", // Log info and above to standard output
34
37
},
35
-
ErrorOutputPaths: []string{
38
+
ErrorOutputPaths: []string{// is similar to OutputPaths but is used for Zap's internal errors only, not those generated or logged by your application (such as the error from mismatched loosely-typed key/value pairs).
36
39
"stderr", // Log internal Zap errors to standard error
37
40
},
38
-
InitialFields: map[string]interface{}{
39
-
"application": "your-application-name", // Customize this field to suit your needs
41
+
InitialFields: map[string]interface{}{ // specifies global contextual fields that should be included in every log entry produced by each logger created from the Config object
42
+
"pid": os.Getpid(),
43
+
"application": "your-application-name",
40
44
},
41
45
}
42
46
43
47
// Build the logger from the configuration
44
48
logger:=zap.Must(config.Build())
45
49
46
-
// Wrap the Zap logger in your defaultLogger struct, which implements your Logger interface
50
+
// Wrap the Zap logger in your defaultLogger struct, which implements the Logger interface
47
51
return&defaultLogger{
48
52
logger: logger,
49
-
logLevel: LogLevelInfo, // Assuming LogLevelInfo maps to zap.InfoLevel
0 commit comments