Documentation
¶
Index ¶
- Constants
- func AnyPointerSlice[T any](name string, ptrs []*T) slog.Attr
- type CrashReport
- type Logger
- func (l *Logger) CatchAndReportCrash() any
- func (l *Logger) Debug(msg string, args ...any)
- func (l *Logger) Debugf(msg string, args ...any)
- func (l *Logger) Error(msg string, args ...any)
- func (l *Logger) Errorf(msg string, args ...any)
- func (l *Logger) Info(msg string, args ...any)
- func (l *Logger) Infof(msg string, args ...any)
- func (l *Logger) ReportCrash(err any)
- func (l *Logger) SetCrashReportClient(client *rpc.Client)
- func (l *Logger) SetGPUInfo(vendor, renderer string)
- func (l *Logger) Warn(msg string, args ...any)
- func (l *Logger) Warnf(msg string, args ...any)
- func (l *Logger) With(args ...any) *Logger
- type StackFrame
- type StackFrames
- type SystemInfo
Constants ¶
const RaceEnabled = false
RaceEnabled is false when the race detector is not active.
const ReportCrashRPC = "SimManager.ReportCrash"
ReportCrashRPC is the RPC method name for crash reports.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CrashReport ¶ added in v0.14.0
type CrashReport struct {
Report string
System SystemInfo
Timestamp time.Time
}
CrashReport is sent via RPC when a crash occurs.
type Logger ¶
type Logger struct {
*slog.Logger
LogFile string
LogDir string
Start time.Time
// contains filtered or unexported fields
}
func (*Logger) CatchAndReportCrash ¶
func (*Logger) Debug ¶
Debug wraps slog.Debug to add call stack information (and similarly for the following Logger methods...) Note that we do not wrap the entire slog logging interface, so, for example, WarnContext and Log do not have callstacks included.
We also wrap the logging methods to allow a nil *Logger, in which case debug and info messages are discarded (though warnings and errors still go through to slog.)
func (*Logger) Debugf ¶
Debugf is a convenience wrapper that logs just a message and allows printf-style formatting of the provided args.
func (*Logger) ReportCrash ¶ added in v0.13.0
func (*Logger) SetCrashReportClient ¶ added in v0.14.0
SetCrashReportClient sets the RPC client to use for sending crash reports to the server. This should be called after connecting to the server.
func (*Logger) SetGPUInfo ¶ added in v0.14.0
SetGPUInfo sets the GPU information for crash reports. This should be called after OpenGL is initialized.
type StackFrame ¶
type StackFrame struct {
File string `json:"file"`
Line int `json:"line"`
Function string `json:"function"`
}
func (StackFrame) String ¶
func (f StackFrame) String() string
type StackFrames ¶
type StackFrames []StackFrame
func Callstack ¶
func Callstack(fr []StackFrame) StackFrames
func (StackFrames) String ¶
func (f StackFrames) String() string
func (StackFrames) Strings ¶
func (f StackFrames) Strings() []string