Documentation ¶
Index ¶
- Constants
- func HeaderKey(header string) string
- func InjectMetadata(ctx context.Context) context.Context
- func IsDebug() bool
- func NotFound(what ContextKey) error
- func SetGlobalLogLevel(loglevel Loglevel)
- func TypeOf[T any]() string
- func WithTelemetry() bool
- type CodePath
- type CodeReference
- type Console
- type ContextKey
- type Identifier
- type Log
- type LogField
- func ApplicationField(name string) *LogField
- func DirField(dir string) *LogField
- func ErrField(err error) *LogField
- func Field(key string, value any) *LogField
- func FileField(file string) *LogField
- func FocusField() *LogField
- func GenericField[T any]() *LogField
- func InField(s string) *LogField
- func NameField(name string) *LogField
- func NullableField[T any](key string, value T) *LogField
- func PathField(dir string) *LogField
- func PointerField[T any](override *T) *LogField
- func ProjectField(name string) *LogField
- func RequestField(req any) *LogField
- func ResponseField(req any) *LogField
- func ServiceField(name string) *LogField
- func SliceCountField[T any](slice []T) *LogField
- func StatusFailed() *LogField
- func StatusOK() *LogField
- func ThisField(this Unique) *LogField
- func Writer() *LogField
- type LogProcessor
- type LogProcessorWithSource
- type Loglevel
- type NotFoundError
- type Provider
- type Resource
- type Unique
- type Wool
- func (w *Wool) Catch()
- func (w *Wool) Close() error
- func (w *Wool) Debug(msg string, fields ...*LogField)
- func (w *Wool) Error(msg string, fields ...*LogField)
- func (w *Wool) Fatal(msg string, fields ...*LogField)
- func (w *Wool) Focus(msg string, fields ...*LogField)
- func (w *Wool) Forward(p []byte) (n int, err error)
- func (w *Wool) In(method string, fields ...*LogField) *Wool
- func (w *Wool) Info(msg string, fields ...*LogField)
- func (w *Wool) Inject(ctx context.Context) context.Context
- func (w *Wool) LogLevel() Loglevel
- func (w *Wool) Name() string
- func (w *Wool) NewError(format string, args ...any) error
- func (w *Wool) Source() *Identifier
- func (w *Wool) StackTrace() []CodePath
- func (w *Wool) Trace(msg string, fields ...*LogField)
- func (w *Wool) UserAuthID() (string, error)
- func (w *Wool) UserEmail() (string, error)
- func (w *Wool) UserGivenName() (string, error)
- func (w *Wool) UserName() (string, error)
- func (w *Wool) Warn(msg string, fields ...*LogField)
- func (w *Wool) With(fields ...*LogField) *Wool
- func (w *Wool) WithLogger(l LogProcessor) *Wool
- func (w *Wool) WithLoglevel(level Loglevel)
- func (w *Wool) Wrap(err error) error
- func (w *Wool) Wrapf(err error, msg string, args ...any) error
- func (w *Wool) Write(p []byte) (n int, err error)
Constants ¶
View Source
const CodePathKey = "codepath"
View Source
const LogEvent = "log"
View Source
const ProviderKey = ContextKey("provider")
Variables ¶
This section is empty.
Functions ¶
func HeaderKey ¶ added in v0.1.16
HeaderKey sanitizes the header name to be used in metadata Append wool: Lower case Suppress X-Codefly
func NotFound ¶ added in v0.1.18
func NotFound(what ContextKey) error
func SetGlobalLogLevel ¶ added in v0.0.65
func SetGlobalLogLevel(loglevel Loglevel)
func WithTelemetry ¶
func WithTelemetry() bool
Types ¶
type CodeReference ¶ added in v0.0.60
func (*CodeReference) String ¶ added in v0.0.71
func (c *CodeReference) String() string
type ContextKey ¶
type ContextKey string
const UserAuthIDKey ContextKey = "codefly.user.auth.id"
const UserEmailKey ContextKey = "codefly.user.email"
const UserGivenNameKey ContextKey = "codefly.user.given_name"
const UserNameKey ContextKey = "codefly.user.name"
type Identifier ¶ added in v0.0.55
func System ¶ added in v0.0.67
func System() *Identifier
func (*Identifier) IsSystem ¶ added in v0.0.67
func (identifier *Identifier) IsSystem() bool
type Log ¶
type Log struct { Level Loglevel `json:"level"` Header string `json:"header"` Message string `json:"message"` Fields []*LogField `json:"fields"` }
func (*Log) Event ¶
func (l *Log) Event() trace.SpanStartEventOption
type LogField ¶
type LogField struct { Key string `json:"key"` Level Loglevel `json:"level"` Value any `json:"value"` }
LogField is a key value pair with a log level A Field is shown only if the log level is equal or higher than the log level of the log
func ApplicationField ¶ added in v0.1.18
func FocusField ¶ added in v0.0.69
func FocusField() *LogField
func GenericField ¶ added in v0.0.55
func NullableField ¶ added in v0.0.81
func PointerField ¶ added in v0.0.57
func ProjectField ¶ added in v0.1.18
func RequestField ¶ added in v0.0.55
func ResponseField ¶ added in v0.0.67
func ServiceField ¶ added in v0.1.18
func SliceCountField ¶ added in v0.0.57
func StatusFailed ¶ added in v0.0.55
func StatusFailed() *LogField
type LogProcessor ¶ added in v0.0.55
type LogProcessor interface {
Process(msg *Log)
}
type LogProcessorWithSource ¶ added in v0.0.55
type LogProcessorWithSource interface {
ProcessWithSource(source *Identifier, msg *Log)
}
type Loglevel ¶
type Loglevel int
func GlobalLogLevel ¶ added in v0.0.65
func GlobalLogLevel() Loglevel
type NotFoundError ¶ added in v0.1.18
type NotFoundError struct {
// contains filtered or unexported fields
}
func (*NotFoundError) Error ¶ added in v0.1.18
func (err *NotFoundError) Error() string
type Provider ¶ added in v0.0.55
type Provider struct {
// contains filtered or unexported fields
}
Provider keeping track
func (*Provider) WithConsole ¶ added in v0.0.69
func (*Provider) WithLogger ¶ added in v0.0.55
func (provider *Provider) WithLogger(l LogProcessor) *Provider
type Resource ¶ added in v0.0.55
type Resource struct { Resource *resource.Resource *Identifier }
type Wool ¶
type Wool struct {
// contains filtered or unexported fields
}
func (*Wool) Catch ¶ added in v0.0.55
func (w *Wool) Catch()
Catch recovers from a panic and logs the error
func (*Wool) Source ¶ added in v0.0.67
func (w *Wool) Source() *Identifier
func (*Wool) StackTrace ¶ added in v0.0.55
func (*Wool) UserAuthID ¶ added in v0.1.35
UserAuthID returns the ID from the Auth process from the context
func (*Wool) UserGivenName ¶ added in v0.1.35
UserGivenName returns the UserGivenName from the context
func (*Wool) WithLogger ¶ added in v0.0.55
func (w *Wool) WithLogger(l LogProcessor) *Wool
func (*Wool) WithLoglevel ¶ added in v0.0.87
Source Files ¶
Click to show internal directories.
Click to hide internal directories.