Documentation
¶
Index ¶
- Constants
- type BackendLogger
- func (b *BackendLogger) Debug(_ context.Context, msg string, fields map[string]any)
- func (b *BackendLogger) Error(_ context.Context, msg string, fields map[string]any)
- func (b *BackendLogger) Info(_ context.Context, msg string, fields map[string]any)
- func (b *BackendLogger) ListLogFiles(_ context.Context) ([]string, error)
- func (b *BackendLogger) Log(ctx context.Context, level, msg string, fields map[string]any)
- func (b *BackendLogger) ReadLog(_ context.Context, name string) (string, error)
- func (b *BackendLogger) SearchLog(_ context.Context, name, pattern string) ([]string, error)
- func (b *BackendLogger) ServiceShutdown() error
- func (b *BackendLogger) ServiceStartup(_ context.Context, _ application.ServiceOptions) error
- func (b *BackendLogger) StartTail(_ context.Context, name string) error
- func (b *BackendLogger) StopTail(_ context.Context, name string) error
- func (b *BackendLogger) Warn(_ context.Context, msg string, fields map[string]any)
- type DiagnosticsClient
- func (c *DiagnosticsClient) Debug(msg string, fields map[string]any)
- func (c *DiagnosticsClient) Error(msg string, fields map[string]any)
- func (c *DiagnosticsClient) Info(msg string, fields map[string]any)
- func (c *DiagnosticsClient) Log(level, msg string, fields map[string]any)
- func (c *DiagnosticsClient) ReadLog(logType string) (string, error)
- func (c *DiagnosticsClient) ReportStartupReady(marks map[string]float64)
- func (c *DiagnosticsClient) StartTail(logType string) error
- func (c *DiagnosticsClient) StopTail(logType string) error
- func (c *DiagnosticsClient) Warn(msg string, fields map[string]any)
Constants ¶
const ( // StartupReportEnv names a file the startup report is written to as JSON. // Used by scripts/perf/coldstart.sh. StartupReportEnv = "OMNIVIEW_STARTUP_REPORT" // StartupExitEnv makes the app quit as soon as the startup report is written. StartupExitEnv = "OMNIVIEW_STARTUP_EXIT" )
const (
// LogUpdateFmt is the event name format used to stream new lines of a tailed log.
LogUpdateFmt = "internal/log/update:%s"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendLogger ¶
type BackendLogger struct {
Sugared *zap.SugaredLogger
// contains filtered or unexported fields
}
func NewBackendLogger ¶
func NewBackendLogger(name string, dev bool, logDir string) (*BackendLogger, error)
NewBackendLogger creates (and binds) a Zap SugaredLogger writing to `<name>.log`. logDir is the directory where log files are stored (e.g. from appstate.Service.Logs().ResolvePath("")).
func (*BackendLogger) ListLogFiles ¶
func (b *BackendLogger) ListLogFiles(_ context.Context) ([]string, error)
func (*BackendLogger) ServiceShutdown ¶ added in v0.4.0
func (b *BackendLogger) ServiceShutdown() error
func (*BackendLogger) ServiceStartup ¶ added in v0.4.0
func (b *BackendLogger) ServiceStartup(_ context.Context, _ application.ServiceOptions) error
func (*BackendLogger) StartTail ¶
func (b *BackendLogger) StartTail(_ context.Context, name string) error
type DiagnosticsClient ¶
type DiagnosticsClient struct {
UI *BackendLogger
}
DiagnosticsClient provides a client to the UI to be able to record ui side logs, view ui and backend logs, as well as other diagnostic imformation.
func NewDiagnosticsClient ¶
func NewDiagnosticsClient(dev bool, logDir string) *DiagnosticsClient
func (*DiagnosticsClient) Debug ¶
func (c *DiagnosticsClient) Debug(msg string, fields map[string]any)
Debug records a debug level log to the log sink.
func (*DiagnosticsClient) Error ¶
func (c *DiagnosticsClient) Error(msg string, fields map[string]any)
Error records an error level log to the log sink.
func (*DiagnosticsClient) Info ¶
func (c *DiagnosticsClient) Info(msg string, fields map[string]any)
Info records an info level log to the log sink.
func (*DiagnosticsClient) Log ¶
func (c *DiagnosticsClient) Log(level, msg string, fields map[string]any)
Log records an arbitrary log with a set level to the log sink.
func (*DiagnosticsClient) ReadLog ¶
func (c *DiagnosticsClient) ReadLog(logType string) (string, error)
ReadLog returns the string contents of the log requested.
func (*DiagnosticsClient) ReportStartupReady ¶ added in v0.4.0
func (c *DiagnosticsClient) ReportStartupReady(marks map[string]float64)
ReportStartupReady is called once by the frontend when the shell is first interactive. marks carries frontend timings (milliseconds). The report is printed to stderr, and written to $OMNIVIEW_STARTUP_REPORT when set.
func (*DiagnosticsClient) StartTail ¶
func (c *DiagnosticsClient) StartTail(logType string) error
StartTail starts tailing the log to the event stream.
func (*DiagnosticsClient) StopTail ¶
func (c *DiagnosticsClient) StopTail(logType string) error
StopTail stops tailing the log to the event stream.