Documentation ¶
Index ¶
- func Debug(msg string) (err error)
- func DebugWithCtx(ctx context.Context, msg string) (err error)
- func DebugWithCtxf(ctx context.Context, format string, a ...interface{}) (err error)
- func DebugWithSpan(span trace.Span, msg string) (err error)
- func DebugWithSpanf(span trace.Span, format string, a ...interface{}) (err error)
- func Debugf(format string, a ...interface{}) (err error)
- func Enabled(s Severity) bool
- func Error(msg string) (err error)
- func ErrorWithCtx(ctx context.Context, msg string) (err error)
- func ErrorWithCtxf(ctx context.Context, format string, a ...interface{}) (err error)
- func ErrorWithSpan(span trace.Span, msg string) (err error)
- func ErrorWithSpanf(span trace.Span, format string, a ...interface{}) (err error)
- func Errorf(format string, a ...interface{}) (err error)
- func Info(msg string) (err error)
- func InfoWithCtx(ctx context.Context, msg string) (err error)
- func InfoWithCtxf(ctx context.Context, format string, a ...interface{}) (err error)
- func InfoWithSpan(span trace.Span, msg string) (err error)
- func InfoWithSpanf(span trace.Span, format string, a ...interface{}) (err error)
- func Infof(format string, a ...interface{}) (err error)
- func ReportError(msg string) (err error)
- func ReportErrorWithCtx(ctx context.Context, msg string) (err error)
- func ReportErrorWithCtxf(ctx context.Context, format string, a ...interface{}) (err error)
- func ReportErrorWithSpan(span trace.Span, msg string) (err error)
- func ReportErrorWithSpanf(span trace.Span, format string, a ...interface{}) (err error)
- func ReportErrorf(format string, a ...interface{}) (err error)
- func Setup(traceProjectID string, opts ...Option) error
- func Warn(msg string) (err error)
- func WarnWithCtx(ctx context.Context, msg string) (err error)
- func WarnWithCtxf(ctx context.Context, format string, a ...interface{}) (err error)
- func WarnWithSpan(span trace.Span, msg string) (err error)
- func WarnWithSpanf(span trace.Span, format string, a ...interface{}) (err error)
- func Warnf(format string, a ...interface{}) (err error)
- type Entry
- type Option
- type Severity
- type SourceLocation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DebugWithCtx ¶
DebugWithCtx logs a message at SeverityDebug.
func DebugWithCtxf ¶ added in v0.3.0
DebugWithCtxf logs a message at SeverityDebug.
func DebugWithSpan ¶
DebugWithSpan logs a message at SeverityDebug.
func DebugWithSpanf ¶ added in v0.3.0
DebugWithSpanf logs a message at SeverityDebug.
func ErrorWithCtx ¶
ErrorWithCtx logs a message at SeverityError.
func ErrorWithCtxf ¶ added in v0.3.0
ErrorWithCtxf logs a message at SeverityError.
func ErrorWithSpan ¶
ErrorWithSpan logs a message at SeverityError.
func ErrorWithSpanf ¶ added in v0.3.0
ErrorWithSpanf logs a message at SeverityError.
func InfoWithCtx ¶
InfoWithCtx logs a message at SeverityInfo.
func InfoWithCtxf ¶ added in v0.3.0
InfoWithCtxf logs a message at SeverityInfo.
func InfoWithSpan ¶
InfoWithSpan logs a message at SeverityInfo.
func InfoWithSpanf ¶ added in v0.3.0
InfoWithSpanf logs a message at SeverityInfo.
func ReportError ¶ added in v0.2.0
ReportError outputs a log with stacktrace so that error reporting can recognize the error.
func ReportErrorWithCtx ¶ added in v0.2.0
ReportErrorWithCtx outputs a log with stacktrace so that error reporting can recognize the error.
func ReportErrorWithCtxf ¶ added in v0.3.0
ReportErrorWithCtx outputs a log with stacktrace so that error reporting can recognize the error.
func ReportErrorWithSpan ¶ added in v0.2.0
ReportErrorWithSpan outputs a log with stacktrace so that error reporting can recognize the error.
func ReportErrorWithSpanf ¶ added in v0.3.0
ReportErrorWithSpanf outputs a log with stacktrace so that error reporting can recognize the error.
func ReportErrorf ¶ added in v0.3.0
ReportErrorf outputs a log with stacktrace so that error reporting can recognize the error.
func WarnWithCtx ¶
WarnWithCtx logs a message at SeverityWarning.
func WarnWithCtxf ¶ added in v0.3.0
WarnWithCtxf logs a message at SeverityWarning.
func WarnWithSpan ¶
WarnWithSpan logs a message at SeverityWarning.
func WarnWithSpanf ¶ added in v0.3.0
WarnWithSpanf logs a message at SeverityWarning.
Types ¶
type Entry ¶
type Entry struct { // A severity as string. Severity string `json:"severity"` // Optional. Resource name of the trace associated with the log entry, if any. // If it contains a relative resource name, the name is assumed to be relative to //tracing.googleapis.com. // Example: projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824 Trace string `json:"logging.googleapis.com/trace,omitempty"` // Optional. The span ID within the trace associated with the log entry. // For Trace spans, this is the same format that the Trace API v2 uses: a 16-character hexadecimal encoding // of an 8-byte array, such as 000000000000004a. SpanID string `json:"logging.googleapis.com/spanId,omitempty"` // Optional. Source code location information associated with the log entry, if any. SourceLocation *SourceLocation `json:"logging.googleapis.com/sourceLocation,omitempty"` // The log entry payload, represented as a Unicode string (UTF-8). Message string `json:"message"` }
Entry is a log entry. See https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry.
type Option ¶
type Option func()
An Option is an option for a slog package.
func WithLogLevel ¶
WithLogLevel returns an Option that specifies a log level.
func WithSeverity ¶ added in v0.2.0
WithSeverity returns an Option that specifies a severity. Default severity is SeverityDebug.
type Severity ¶
type Severity uint32
Severity is implementation of https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#LogSeverity.
const ( // SeverityDefault represents log entry has no assigned severity level. SeverityDefault Severity = 0 // SeverityDebug represents debug or trace information. SeverityDebug Severity = 1 // SeverityInfo represents routine information, such as ongoing status or performance. SeverityInfo Severity = 2 // SeverityNotice represents normal but significant events, such as start up, shut down, or a configuration change. SeverityNotice Severity = 3 // SeverityWarning represents warning events might cause problems. SeverityWarning Severity = 4 // SeverityError represents error events are likely to cause problems. SeverityError Severity = 5 // SeverityCritical represents critical events cause more severe problems or outages. SeverityCritical Severity = 6 // SeverityAlert represents a person must take an action immediately. SeverityAlert Severity = 7 // SeverityEmergency represents one or more systems are unusable. SeverityEmergency Severity = 8 )
type SourceLocation ¶
type SourceLocation struct { // Optional. Source file name. Depending on the runtime environment, // this might be a simple name or a fully-qualified name. File string `json:"file,omitempty"` // Optional. Line within the source file. 1-based; 0 indicates no line number available. Line int64 `json:"line,omitempty"` // Optional. Human-readable name of the function or method being invoked, // with optional context such as the class or package name. // This information may be used in contexts such as the logs viewer, // where a file and line number are less meaningful. The format can vary by language. // For example: qual.if.ied.Class.method (Java), dir/package.func (Go), function (Python). Function string `json:"function,omitempty"` }
SourceLocation is additional information about the source code location that produced the log entry.