Documentation
¶
Index ¶
- func MustNewGCPCloudLogging(params GCPCloudLoggingLogFormatterParams) *gcpCloudLoggingLogFormatter
- func NewDefault() *defaultLogFormatter
- func NewGCPCloudLogging(params GCPCloudLoggingLogFormatterParams) (*gcpCloudLoggingLogFormatter, error)
- type GCPCloudLoggingLogFormatterParams
- type LogAttribute
- type LogAttributeSet
- type LogInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustNewGCPCloudLogging ¶ added in v0.2.4
func MustNewGCPCloudLogging(params GCPCloudLoggingLogFormatterParams) *gcpCloudLoggingLogFormatter
MustNewGCPCloudLogging creates a new GCP Cloud Logging LogFormatter. It panics if any error is found.
func NewDefault ¶
func NewDefault() *defaultLogFormatter
NewDefault creates a new default LogFormatter.
func NewGCPCloudLogging ¶
func NewGCPCloudLogging(params GCPCloudLoggingLogFormatterParams) (*gcpCloudLoggingLogFormatter, error)
NewGCPCloudLogging creates a new GCP Cloud Logging LogFormatter.
Types ¶
type GCPCloudLoggingLogFormatterParams ¶ added in v0.2.4
type GCPCloudLoggingLogFormatterParams struct { ProjectID string ApplicationName string ApplicationVersion string }
GCPCloudLoggingLogFormatterParams encapsulates necessary parameters to construct a GCP Cloud Logging LogFormatter.
type LogAttribute ¶
type LogAttribute string
LogAttribute represents an information to be extracted from the context and included into the log.
const ( // LogAttributeRootError defines the name of the RooError attribute attached into logs. LogAttributeRootError LogAttribute = "root_error" // LogAttributeErrorKind defines the name of the ErrorKind attribute attached into logs. LogAttributeErrorKind LogAttribute = "err_kind" // LogAttributeErrorCode defines the name of the ErrorCode attribute attached into logs. LogAttributeErrorCode LogAttribute = "err_code" )
type LogAttributeSet ¶
type LogAttributeSet map[LogAttribute]bool
LogAttributeSet is a set of LogAttributes.
var DefaultGRPCServerAttributeSet LogAttributeSet = LogAttributeSet{ LogAttribute(semconv.ServiceNameKey): true, LogAttribute(semconv.ServiceVersionKey): true, LogAttribute(semconv.NetPeerIPKey): true, LogAttribute(semconv.RPCMethodKey): true, LogAttribute(semconv.RPCGRPCStatusCodeKey): true, LogAttribute(grpc_interceptor.GRPCResponseLatencyKey): true, }
DefaultGRPCServerAttributeSet defines some useful LogAttributes usually used in gRPC Servers context.
var DefaultHTTPServerAttributeSet LogAttributeSet = LogAttributeSet{ LogAttribute(semconv.ServiceNameKey): true, LogAttribute(semconv.ServiceVersionKey): true, LogAttribute(semconv.NetPeerIPKey): true, LogAttribute(semconv.HTTPMethodKey): true, LogAttribute(semconv.HTTPRouteKey): true, LogAttribute(semconv.HTTPStatusCodeKey): true, LogAttribute(semconv.HTTPResponseContentLengthKey): true, LogAttribute(middleware.HTTPResponseLatencyKey): true, }
DefaultHTTPServerAttributeSet defines some useful LogAttributes usually used in HTTP Servers context.
func (LogAttributeSet) Add ¶ added in v0.2.6
func (s LogAttributeSet) Add(attr LogAttribute) LogAttributeSet
Add creates a new LogAttributeSet with the given LogAttribute attached.
func (LogAttributeSet) Merge ¶ added in v0.2.6
func (s LogAttributeSet) Merge(set LogAttributeSet) LogAttributeSet
Merge merges the given LogAttributeSet into the existing one and returns a copy of the result.