package zen import ( "gitlab.bareksa.com/backend/zen/core/zlog" ) var ( // Info logs a message at level Info. // Use this method to log basic information like "server is starting". // // To log with additional information, use the Infof or Infow methods. // // Use Infof to log with a format. // // Use Infow to log with additional json fields. Info = zlog.Info // Infof logs a message at level Info with format. // // msg and args are passed to fmt.Sprintf. // // Use Infow to log with additional json fields. // // Use Infow to print structs and maps since they will // be rendered as json. // // Example: // // zen.Infof(ctx, "user '%s' logged in", user) Infof = zlog.Infof // Infow logs a message with additional json fields. // // Use Infow to render structs and maps as json. // // fields is an alternating key-value sequence. // `key` must be a string type (including not alias), and `value` can be any // serializeable type. // // wrong number of fields or non-string key will cause the misplaced // value to be paired with `!BADKEY` key. // // failing to serialize json value will cause the value to be replaced with // the string `!ERROR:{reason}`. // // If value implements [slog.LogValuer] interface, it will be used as log fields. // If does not, it will look if it implements [json.Marshaler] interface and // use it to serialize. // Then for the last resort, use normal json.Marshal. // // Note that primitive values are already optimized and will not use heavy reflection. // // Example: // // zen.Infow(ctx, "API called without error", // "method", request.Method, // "path", request.URL.Path, // "query", request.URL.Query(), // "duration", dur, // ) Infow = zlog.Infow // Debug logs a message at level Debug. // Use this method to log detailed information for debugging purposes. // // To log with additional information, use the Debugf or Debugw methods. // // Use [Debugf] to log with a format. // // Use [Debugw] to log with additional json fields. Debug = zlog.Debug // Debugf logs a message at level Debug with format. // // msg and args are passed to fmt.Sprintf. // // Use Debugw to log with additional json fields. // // Use Debugw to print structs and maps since they will // be rendered as json. // // Example: // // zen.Debugf(ctx, "user '%s' logged in", user) Debugf = zlog.Debugf // Debugw logs a message with additional json fields. // // Use Debugw to render structs and maps as json. // // fields is an alternating key-value sequence. // `key` must be a string type (including not alias), and `value` can be any // serializeable type. // // wrong number of fields or non-string key will cause the misplaced // value to be paired with `!BADKEY` key. // // failing to serialize json value will cause the value to be replaced with // the string `!ERROR:{reason}`. // // If value implements [slog.LogValuer] interface, it will be used as log fields. // If does not, it will look if it implements [json.Marshaler] interface and // use it to serialize. // Then for the last resort, use normal json.Marshal. // // Example: // // zen.Debugw(ctx, "database query", // "query", query, // "args", args, // ) Debugw = zlog.Debugw // Warn logs a message at level Warn. // Use this method to log warnings. // // To log with additional information, use the Warnf or Warnw methods. // // Use Warnf to log with a format. // // Use Warnw to log with additional json fields. Warn = zlog.Warn // Warnf logs a message at level Warn with format. // // msg and args are passed to fmt.Sprintf. // // Use Warnw to log with additional json fields. // // Use Warnw to print structs and maps since they will // be rendered as json. // // Example: // // zen.Warnf(ctx, "user '%s' logged in", user) Warnf = zlog.Warnf // Warnw logs a message with additional json fields. // // Use Warnw to render structs and maps as json. // // fields is an alternating key-value sequence. // `key` must be a string type (including not alias), and `value` can be any // serializeable type. // // wrong number of fields or non-string key will cause the misplaced // value to be paired with `!BADKEY` key. // // failing to serialize json value will cause the value to be replaced with // the string `!ERROR:{reason}`. // // If value implements [slog.LogValuer] interface, it will be used as log fields. // If does not, it will look if it implements [json.Marshaler] interface and // use it to serialize. // Then for the last resort, use normal json.Marshal. Warnw = zlog.Warnw // Error logs a message at level Error. // Use this method to log errors. // // To log with additional information, use the Errorf or Errorw methods. // // Use Errorf to log with a format. // // Use Errorw to log with additional json fields. Error = zlog.Error // Errorf logs a message at level Error with format. // // msg and args are passed to fmt.Sprintf. // // Use Errorw to log with additional json fields. // // Use Errorw to print structs and maps since they will // be rendered as json. // // Example: // // zen.Errorf(ctx, "user '%s' logged in", user) Errorf = zlog.Errorf // Errorw logs a message with additional json fields. // // Use Errorw to render structs and maps as json. // // fields is an alternating key-value sequence. // `key` must be a string type (including not alias), and `value` can be any // serializeable type. // // wrong number of fields or non-string key will cause the misplaced // value to be paired with `!BADKEY` key. // // failing to serialize json value will cause the value to be replaced with // the string `!ERROR:{reason}`. // // If value implements [slog.LogValuer] interface, it will be used as log fields. // If does not, it will look if it implements [json.Marshaler] interface and // use it to serialize. // Then for the last resort, use normal json.Marshal. // // Example: // // zlog.Errorw(ctx, "RPC Error", // "error", err, // "requeset", request, // ) Errorw = zlog.Errorw // SetDefaultLogger sets the default logger that is // used by the package level functions. // // SetDefaultLogger is not thread-safe and should be // called early in the startup phase of the application. SetDefaultLogger = zlog.SetDefault )