Documentation ¶
Index ¶
- type Loc
- type LogErr
- type LogItem
- func (li *LogItem) AppendParentError(err ...error) *LogItem
- func (li *LogItem) Error() string
- func (li *LogItem) ErrorHas(err error) bool
- func (li *LogItem) Get(key string) (it any, ok bool)
- func (lt *LogItem) Now() *LogItem
- func (lt *LogItem) Print(print_option ...PrintOptions) string
- func (li *LogItem) Set(key string, value any) *LogItem
- func (li *LogItem) SetAfter(after string) *LogItem
- func (li *LogItem) SetAfterf(after string, v ...any) *LogItem
- func (li *LogItem) SetLevel(level LogLevel) *LogItem
- func (li *LogItem) SetLoc(loc Loc) *LogItem
- func (li *LogItem) SetLocf(str string, v ...any) *LogItem
- func (lt *LogItem) SetMessage(v ...any) *LogItem
- func (lt *LogItem) SetMessagef(str string, v ...any) *LogItem
- func (li *LogItem) SetTime(t time.Time) *LogItem
- func (li *LogItem) Setf(key string, str string, value ...any) *LogItem
- func (li *LogItem) String() string
- type LogLevel
- type PrintOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogItem ¶
type LogItem struct { Location Loc `json:"location"` Time time.Time `json:"time"` After string `json:"after"` Body map[string]any `json:"body"` Message string `json:"message"` Level LogLevel `json:"log_level"` CallStack []error `json:"call_stack"` }
func NewLogItem ¶
func (*LogItem) AppendParentError ¶
func (*LogItem) Print ¶
func (lt *LogItem) Print(print_option ...PrintOptions) string
func (*LogItem) SetMessage ¶
type LogLevel ¶
type LogLevel int
const ( LogLevelWrite LogLevel = iota - 1 /* Only when I would be "tracing" the code and trying to find one part of a function specifically. */ LogLevelTrace /* Information that is diagnostically helpful to people more than just developers (IT, sysadmins, etc.). */ LogLevelDebug01 /* Information that is diagnostically helpful to people more than just developers (IT, sysadmins, etc.). */ LogLevelDebug02 /* Information that is diagnostically helpful to people more than just developers (IT, sysadmins, etc.). */ LogLevelDebug03 /* Information that is diagnostically helpful to people more than just developers (IT, sysadmins, etc.). */ LogLevelDebug04 /* Information that is diagnostically helpful to people more than just developers (IT, sysadmins, etc.). */ LogLevelDebug05 /* Information that is diagnostically helpful to people more than just developers (IT, sysadmins, etc.). */ LogLevelDebug06 /* Generally useful information to log (service start/stop, configuration assumptions, etc). Info I want to always have available but usually don't care about under normal circumstances. This is my out-of-the-box config level. */ LogLevelInfo01 /* Generally useful information to log (service start/stop, configuration assumptions, etc). Info I want to always have available but usually don't care about under normal circumstances. This is my out-of-the-box config level. */ LogLevelInfo02 /* Generally useful information to log (service start/stop, configuration assumptions, etc). Info I want to always have available but usually don't care about under normal circumstances. This is my out-of-the-box config level. */ LogLevelInfo03 /* Anything that can potentially cause application oddities, but for which I am automatically recovering. (Such as switching from a primary to backup server, retrying an operation, missing secondary data, etc.) */ LogLevelWarn /* Any error which is fatal to the operation, but not the service or application (can't open a required file, missing data, etc.). These errors will force user (administrator, or direct user) intervention. These are usually reserved (in my apps) for incorrect connection strings, missing services, etc. */ LogLevelError01 /* Any error which is fatal to the operation, but not the service or application (can't open a required file, missing data, etc.). These errors will force user (administrator, or direct user) intervention. These are usually reserved (in my apps) for incorrect connection strings, missing services, etc. */ LogLevelError02 /* Any error that is forcing a shutdown of the service or application to prevent data loss (or further data loss). I reserve these only for the most heinous errors and situations where there is guaranteed to have been data corruption or loss. */ LogLevelFatal )
type PrintOptions ¶
type PrintOptions = int
const ( PO_LINE PrintOptions = iota + 1 PO_JSON PO_PLAIN )
Click to show internal directories.
Click to hide internal directories.