Skip to content

package logging

import "kaijuengine.com/engine/systems/logging"

Functions

ExtPlatformLogError

func ExtPlatformLogError(message string)

ExtPlatformLogInfo

func ExtPlatformLogInfo(message string)

ExtPlatformLogVerbose

func ExtPlatformLogVerbose(message string)

ExtPlatformLogWarn

func ExtPlatformLogWarn(message string)

LogFilePath

func LogFilePath() (string, error)

LogFilePath returns the absolute path of the active log file that the running editor/engine is appending to. The path is stable for the lifetime of the process; across restarts the previous file is rotated by renameOldLogFile before a new one is opened at the same path.

LogFolderPath

func LogFolderPath() (string, error)

ToMap

func ToMap(logMessage string) map[string]string

Types

Event

struct

type Event struct {
    // Has unexported fields.
}

Event.Add

func (e *Event) Add(call func(string)) EventId

Event.Execute

func (e *Event) Execute(message string)

Event.IsEmpty

func (e Event) IsEmpty() bool

Event.Remove

func (e *Event) Remove(id EventId)

EventId

int64

type EventId = int64

LogStream

struct

type LogStream struct {
    OnInfo  Event
    OnWarn  TracedEvent
    OnError TracedEvent
    File    *os.File
}

Initialize

func Initialize(opts *slog.HandlerOptions) *LogStream

LogStream.Close

func (l *LogStream) Close()

LogStream.Write

func (l *LogStream) Write(p []byte) (n int, err error)

RuntimeLogHandler

struct

type RuntimeLogHandler struct {
    slog.Handler
}

RuntimeLogHandler.Enabled

func (e *RuntimeLogHandler) Enabled(_ context.Context, level slog.Level) bool

TracedEvent

struct

type TracedEvent struct {
    // Has unexported fields.
}

TracedEvent.Add

func (e *TracedEvent) Add(call func(msg string, trace []string)) EventId

TracedEvent.Execute

func (e *TracedEvent) Execute(message string, trace []string)

TracedEvent.IsEmpty

func (e TracedEvent) IsEmpty() bool

TracedEvent.Remove

func (e *TracedEvent) Remove(id EventId)