Documentation ¶
Index ¶
- Constants
- func Dump(i interface{}) string
- func GetEnv(key string, defaultValue interface{}) string
- func JSONMarshal(data interface{}) ([]byte, error)
- func OtelSeverityText(lv logrus.Level) string
- func SetAuthHeaderInfoToContext(ginContext *gin.Context, authHeaderInfo AuthHeaderInfo)
- func SetRequestHeaderInfoToContext(ginContext *gin.Context, requestHeaderInfo RequestHeaderInfo)
- func SetupLogger(env string)
- func ToByte(i interface{}) []byte
- func WithContext(ctx context.Context, field map[string]interface{}) *logrus.Entry
- type AuthHeaderInfo
- type Config
- type Fields
- type Formatter
- type ILogger
- type OtelTraceHook
- type RequestHeaderInfo
- type Service
- type TraceHookConfig
Constants ¶
View Source
const FileKey = "file"
FileKey holds the file field
View Source
const FunctionKey = "function"
FunctionKey holds the function field
View Source
const LineKey = "line"
LineKey holds the line field
View Source
const PackageKey = "package"
PackageKey holds the package field
Variables ¶
This section is empty.
Functions ¶
func JSONMarshal ¶ added in v1.2.0
func OtelSeverityText ¶ added in v1.2.0
OtelSeverityText convert logrus level to otel severityText ref to https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md#severity-fields
func SetAuthHeaderInfoToContext ¶ added in v1.2.0
func SetAuthHeaderInfoToContext(ginContext *gin.Context, authHeaderInfo AuthHeaderInfo)
func SetRequestHeaderInfoToContext ¶ added in v1.2.0
func SetRequestHeaderInfoToContext(ginContext *gin.Context, requestHeaderInfo RequestHeaderInfo)
func SetupLogger ¶ added in v1.2.0
func SetupLogger(env string)
Types ¶
type AuthHeaderInfo ¶ added in v1.2.0
type AuthHeaderInfo map[string]interface{}
func GetAuthHeaderInfoFromContext ¶ added in v1.2.0
func GetAuthHeaderInfoFromContext(context context.Context) *AuthHeaderInfo
type Formatter ¶ added in v1.2.0
type Formatter struct { ChildFormatter logrus.Formatter // When true, line number will be tagged to fields as well Line bool // When true, package name will be tagged to fields as well Package bool // When true, file name will be tagged to fields as well File bool // When true, only base name of the file will be tagged to fields BaseNameOnly bool }
Formatter decorates log entries with function name and package name (optional) and line number (optional)
type ILogger ¶
type OtelTraceHook ¶ added in v1.2.0
type OtelTraceHook struct {
// contains filtered or unexported fields
}
func NewOtelTraceHook ¶ added in v1.2.0
func NewOtelTraceHook(cfg *TraceHookConfig) *OtelTraceHook
func (*OtelTraceHook) Fire ¶ added in v1.2.0
func (h *OtelTraceHook) Fire(entry *logrus.Entry) error
func (*OtelTraceHook) Levels ¶ added in v1.2.0
func (h *OtelTraceHook) Levels() []logrus.Level
type RequestHeaderInfo ¶ added in v1.2.0
type RequestHeaderInfo map[string]interface{}
func GetRequestHeaderInfoFromContext ¶ added in v1.2.0
func GetRequestHeaderInfoFromContext(ctx context.Context) *RequestHeaderInfo
func (*RequestHeaderInfo) ToString ¶ added in v1.2.0
func (requestHeaderInfo *RequestHeaderInfo) ToString() string
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.