Documentation ¶
Index ¶
- Variables
- func GetTraceIDTemplate() string
- func GetTraceURLTemplate() string
- func InitSentry(ctx context.Context) (io.Closer, error)
- func Logger() *zerolog.Logger
- func NewEntry(p []byte) *logging.Entry
- func Recover(ctx context.Context, task ...async.Task) error
- func SetDefaultLogger(writer []io.Writer)
- func SetDefaultTracer(v Tracer)
- func SetTimeFieldFormat()
- func Trace(ctx context.Context, s *trace.Span) zerolog.LogObjectMarshaler
- type AppengineEntry
- func (*AppengineEntry) Descriptor() ([]byte, []int)
- func (m *AppengineEntry) GetData() string
- func (m *AppengineEntry) GetMessage() string
- func (m *AppengineEntry) GetSeverity() string
- func (m *AppengineEntry) GetSourceLocation() *AppengineSourceLocation
- func (m *AppengineEntry) GetTime() string
- func (m *AppengineEntry) GetTrace() string
- func (*AppengineEntry) ProtoMessage()
- func (m *AppengineEntry) Reset()
- func (m *AppengineEntry) String() string
- func (m *AppengineEntry) Validate() error
- func (m *AppengineEntry) XXX_DiscardUnknown()
- func (m *AppengineEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *AppengineEntry) XXX_Merge(src proto.Message)
- func (m *AppengineEntry) XXX_Size() int
- func (m *AppengineEntry) XXX_Unmarshal(b []byte) error
- type AppengineEntryValidationError
- func (e AppengineEntryValidationError) Cause() error
- func (e AppengineEntryValidationError) Error() string
- func (e AppengineEntryValidationError) ErrorName() string
- func (e AppengineEntryValidationError) Field() string
- func (e AppengineEntryValidationError) Key() bool
- func (e AppengineEntryValidationError) Reason() string
- type AppengineEntryer
- type AppengineLoggingWriter
- func (p *AppengineLoggingWriter) GetParentProjects() string
- func (p *AppengineLoggingWriter) GetTraceIDTemplate() string
- func (p *AppengineLoggingWriter) GetTraceURLTemplate() string
- func (w *AppengineLoggingWriter) Write(p []byte) (int, error)
- func (w *AppengineLoggingWriter) WriteLevel(level zerolog.Level, p []byte) (int, error)
- type AppengineSourceLocation
- func (*AppengineSourceLocation) Descriptor() ([]byte, []int)
- func (m *AppengineSourceLocation) GetFile() string
- func (m *AppengineSourceLocation) GetFunction() string
- func (m *AppengineSourceLocation) GetLine() string
- func (*AppengineSourceLocation) ProtoMessage()
- func (m *AppengineSourceLocation) Reset()
- func (m *AppengineSourceLocation) String() string
- func (m *AppengineSourceLocation) Validate() error
- func (m *AppengineSourceLocation) XXX_DiscardUnknown()
- func (m *AppengineSourceLocation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *AppengineSourceLocation) XXX_Merge(src proto.Message)
- func (m *AppengineSourceLocation) XXX_Size() int
- func (m *AppengineSourceLocation) XXX_Unmarshal(b []byte) error
- type AppengineSourceLocationValidationError
- func (e AppengineSourceLocationValidationError) Cause() error
- func (e AppengineSourceLocationValidationError) Error() string
- func (e AppengineSourceLocationValidationError) ErrorName() string
- func (e AppengineSourceLocationValidationError) Field() string
- func (e AppengineSourceLocationValidationError) Key() bool
- func (e AppengineSourceLocationValidationError) Reason() string
- type HookMeta
- type StackdriverCloser
- type StackdriverLoggingWriter
- func (p *StackdriverLoggingWriter) Flush() error
- func (p *StackdriverLoggingWriter) GetParentProjects() string
- func (p *StackdriverLoggingWriter) GetTraceIDTemplate() string
- func (p *StackdriverLoggingWriter) GetTraceURLTemplate() string
- func (w *StackdriverLoggingWriter) Write(p []byte) (int, error)
- func (w *StackdriverLoggingWriter) WriteLevel(level zerolog.Level, p []byte) (int, error)
- type StackdriverZerologWriter
- type TraceObject
- type Tracer
Constants ¶
This section is empty.
Variables ¶
var (
Atrace = Trace
)
Functions ¶
func GetTraceIDTemplate ¶
func GetTraceIDTemplate() string
func GetTraceURLTemplate ¶
func GetTraceURLTemplate() string
func SetDefaultLogger ¶
SetDefaultLogger sets up the zerolog.Logger
func SetDefaultTracer ¶
func SetDefaultTracer(v Tracer)
func SetTimeFieldFormat ¶
func SetTimeFieldFormat()
SetTimeFieldFormat sets up the zerolog.TimeFieldFormat
Types ¶
type AppengineEntry ¶
type AppengineEntry struct { Time string `protobuf:"bytes,1,opt,name=time,proto3" json:"time,omitempty"` Trace string `protobuf:"bytes,2,opt,name=trace,proto3" json:"trace,omitempty"` SourceLocation *AppengineSourceLocation `protobuf:"bytes,3,opt,name=source_location,json=sourceLocation,proto3" json:"source_location,omitempty"` Severity string `protobuf:"bytes,4,opt,name=severity,proto3" json:"severity,omitempty"` Message string `protobuf:"bytes,5,opt,name=message,proto3" json:"message,omitempty"` Data string `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
AppengineEntry is ValueObject.
func NewAppengineEntry ¶
func NewAppengineEntry(p []byte) *AppengineEntry
func (*AppengineEntry) Descriptor ¶
func (*AppengineEntry) Descriptor() ([]byte, []int)
func (*AppengineEntry) GetData ¶
func (m *AppengineEntry) GetData() string
func (*AppengineEntry) GetMessage ¶
func (m *AppengineEntry) GetMessage() string
func (*AppengineEntry) GetSeverity ¶
func (m *AppengineEntry) GetSeverity() string
func (*AppengineEntry) GetSourceLocation ¶
func (m *AppengineEntry) GetSourceLocation() *AppengineSourceLocation
func (*AppengineEntry) GetTime ¶
func (m *AppengineEntry) GetTime() string
func (*AppengineEntry) GetTrace ¶
func (m *AppengineEntry) GetTrace() string
func (*AppengineEntry) ProtoMessage ¶
func (*AppengineEntry) ProtoMessage()
func (*AppengineEntry) Reset ¶
func (m *AppengineEntry) Reset()
func (*AppengineEntry) String ¶
func (m *AppengineEntry) String() string
func (*AppengineEntry) Validate ¶
func (m *AppengineEntry) Validate() error
Validate checks the field values on AppengineEntry with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.
func (*AppengineEntry) XXX_DiscardUnknown ¶
func (m *AppengineEntry) XXX_DiscardUnknown()
func (*AppengineEntry) XXX_Marshal ¶
func (m *AppengineEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*AppengineEntry) XXX_Merge ¶
func (m *AppengineEntry) XXX_Merge(src proto.Message)
func (*AppengineEntry) XXX_Size ¶
func (m *AppengineEntry) XXX_Size() int
func (*AppengineEntry) XXX_Unmarshal ¶
func (m *AppengineEntry) XXX_Unmarshal(b []byte) error
type AppengineEntryValidationError ¶
type AppengineEntryValidationError struct {
// contains filtered or unexported fields
}
AppengineEntryValidationError is the validation error returned by AppengineEntry.Validate if the designated constraints aren't met.
func (AppengineEntryValidationError) Cause ¶
func (e AppengineEntryValidationError) Cause() error
Cause function returns cause value.
func (AppengineEntryValidationError) Error ¶
func (e AppengineEntryValidationError) Error() string
Error satisfies the builtin error interface
func (AppengineEntryValidationError) ErrorName ¶
func (e AppengineEntryValidationError) ErrorName() string
ErrorName returns error name.
func (AppengineEntryValidationError) Field ¶
func (e AppengineEntryValidationError) Field() string
Field function returns field value.
func (AppengineEntryValidationError) Key ¶
func (e AppengineEntryValidationError) Key() bool
Key function returns key value.
func (AppengineEntryValidationError) Reason ¶
func (e AppengineEntryValidationError) Reason() string
Reason function returns reason value.
type AppengineEntryer ¶
type AppengineEntryer interface { Descriptor() ([]byte, []int) GetData() map[string]*any.Any GetMessage() string GetSeverity() string GetSourceLocation() *AppengineSourceLocation GetTime() string GetTrace() string ProtoMessage() Reset() String() string Validate() error XXX_DiscardUnknown() XXX_Marshal([]byte, bool) ([]byte, error) XXX_Merge(protoiface.MessageV1) XXX_Size() int XXX_Unmarshal([]byte) error }
AppengineEntryer is an interface generated for "github.com/michilu/boilerplate/service/slog.AppengineEntry".
type AppengineLoggingWriter ¶
type AppengineLoggingWriter struct {
// contains filtered or unexported fields
}
AppengineLogging accepts pre-encoded JSON messages and writes them to Google Appengine Logging and maps Zerolog levels to Appengine levels. The labels argument is ignored if opts includes CommonLabels. The returned client should be closed before the program exits.
func NewAppengineLogging ¶
func NewAppengineLogging(ctx context.Context) (*AppengineLoggingWriter, error)
NewAppengineLogging returns a new AppengineLoggingWriter.
func (*AppengineLoggingWriter) GetParentProjects ¶
func (p *AppengineLoggingWriter) GetParentProjects() string
GetParentProjects returns a string of parent projects. https://godoc.org/cloud.google.com/go/logging#NewClient
func (*AppengineLoggingWriter) GetTraceIDTemplate ¶
func (p *AppengineLoggingWriter) GetTraceIDTemplate() string
GetTraceIDTemplate returns a template string of the stackdriver traceID.
func (*AppengineLoggingWriter) GetTraceURLTemplate ¶
func (p *AppengineLoggingWriter) GetTraceURLTemplate() string
GetTraceURLTemplate returns a template string of the stackdriver traces URL.
func (*AppengineLoggingWriter) Write ¶
func (w *AppengineLoggingWriter) Write(p []byte) (int, error)
Write always returns len(p), nil.
func (*AppengineLoggingWriter) WriteLevel ¶
WriteLevel implements zerolog.LevelWriter. It always returns len(p), nil.
type AppengineSourceLocation ¶
type AppengineSourceLocation struct { File string `protobuf:"bytes,1,opt,name=file,proto3" json:"file,omitempty"` Line string `protobuf:"bytes,2,opt,name=line,proto3" json:"line,omitempty"` Function string `protobuf:"bytes,3,opt,name=function,proto3" json:"function,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
AppengineSourceLocation is ValueObject.
func (*AppengineSourceLocation) Descriptor ¶
func (*AppengineSourceLocation) Descriptor() ([]byte, []int)
func (*AppengineSourceLocation) GetFile ¶
func (m *AppengineSourceLocation) GetFile() string
func (*AppengineSourceLocation) GetFunction ¶
func (m *AppengineSourceLocation) GetFunction() string
func (*AppengineSourceLocation) GetLine ¶
func (m *AppengineSourceLocation) GetLine() string
func (*AppengineSourceLocation) ProtoMessage ¶
func (*AppengineSourceLocation) ProtoMessage()
func (*AppengineSourceLocation) Reset ¶
func (m *AppengineSourceLocation) Reset()
func (*AppengineSourceLocation) String ¶
func (m *AppengineSourceLocation) String() string
func (*AppengineSourceLocation) Validate ¶
func (m *AppengineSourceLocation) Validate() error
Validate checks the field values on AppengineSourceLocation with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.
func (*AppengineSourceLocation) XXX_DiscardUnknown ¶
func (m *AppengineSourceLocation) XXX_DiscardUnknown()
func (*AppengineSourceLocation) XXX_Marshal ¶
func (m *AppengineSourceLocation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*AppengineSourceLocation) XXX_Merge ¶
func (m *AppengineSourceLocation) XXX_Merge(src proto.Message)
func (*AppengineSourceLocation) XXX_Size ¶
func (m *AppengineSourceLocation) XXX_Size() int
func (*AppengineSourceLocation) XXX_Unmarshal ¶
func (m *AppengineSourceLocation) XXX_Unmarshal(b []byte) error
type AppengineSourceLocationValidationError ¶
type AppengineSourceLocationValidationError struct {
// contains filtered or unexported fields
}
AppengineSourceLocationValidationError is the validation error returned by AppengineSourceLocation.Validate if the designated constraints aren't met.
func (AppengineSourceLocationValidationError) Cause ¶
func (e AppengineSourceLocationValidationError) Cause() error
Cause function returns cause value.
func (AppengineSourceLocationValidationError) Error ¶
func (e AppengineSourceLocationValidationError) Error() string
Error satisfies the builtin error interface
func (AppengineSourceLocationValidationError) ErrorName ¶
func (e AppengineSourceLocationValidationError) ErrorName() string
ErrorName returns error name.
func (AppengineSourceLocationValidationError) Field ¶
func (e AppengineSourceLocationValidationError) Field() string
Field function returns field value.
func (AppengineSourceLocationValidationError) Key ¶
func (e AppengineSourceLocationValidationError) Key() bool
Key function returns key value.
func (AppengineSourceLocationValidationError) Reason ¶
func (e AppengineSourceLocationValidationError) Reason() string
Reason function returns reason value.
type StackdriverCloser ¶
type StackdriverCloser struct {
// contains filtered or unexported fields
}
func (*StackdriverCloser) Close ¶
func (p *StackdriverCloser) Close() error
type StackdriverLoggingWriter ¶
type StackdriverLoggingWriter struct { Logger *logging.Logger // contains filtered or unexported fields }
StackdriverLogging accepts pre-encoded JSON messages and writes them to Google Stackdriver Logging and maps Zerolog levels to Stackdriver levels. The labels argument is ignored if opts includes CommonLabels. The returned client should be closed before the program exits.
func NewStackdriverLogging ¶
func NewStackdriverLogging( ctx context.Context, projectID string, logID string, labels map[string]string, opts ...logging.LoggerOption, ) (*StackdriverLoggingWriter, *logging.Client, error)
NewStackdriverLogging returns a new StackdriverLoggingWriter.
func (*StackdriverLoggingWriter) Flush ¶
func (p *StackdriverLoggingWriter) Flush() error
func (*StackdriverLoggingWriter) GetParentProjects ¶
func (p *StackdriverLoggingWriter) GetParentProjects() string
GetParentProjects returns a string of parent projects. https://godoc.org/cloud.google.com/go/logging#NewClient
func (*StackdriverLoggingWriter) GetTraceIDTemplate ¶
func (p *StackdriverLoggingWriter) GetTraceIDTemplate() string
GetTraceIDTemplate returns a template string of the stackdriver traceID.
func (*StackdriverLoggingWriter) GetTraceURLTemplate ¶
func (p *StackdriverLoggingWriter) GetTraceURLTemplate() string
GetTraceURLTemplate returns a template string of the stackdriver traces URL.
func (*StackdriverLoggingWriter) Write ¶
func (w *StackdriverLoggingWriter) Write(p []byte) (int, error)
Write always returns len(p), nil.
func (*StackdriverLoggingWriter) WriteLevel ¶
WriteLevel implements zerolog.LevelWriter. It always returns len(p), nil.
type StackdriverZerologWriter ¶
type StackdriverZerologWriter struct {
// contains filtered or unexported fields
}
func NewStackdriverZerologWriter ¶
func NewStackdriverZerologWriter(ctx context.Context) *StackdriverZerologWriter
NewStackdriverZerologWriter returns a new ZerologWriter.
func (*StackdriverZerologWriter) MarshalZerologObject ¶
func (p *StackdriverZerologWriter) MarshalZerologObject(e *zerolog.Event)
type TraceObject ¶
type TraceObject struct {
// contains filtered or unexported fields
}
Trace is trace span handler for zerolog.
func (*TraceObject) MarshalZerologObject ¶
func (p *TraceObject) MarshalZerologObject(e *zerolog.Event)