Documentation
¶
Index ¶
- func AppDone()
- func DefaultConfig() *config.Config
- func Disable(disconnect bool)
- func Enable()
- func Enabled() bool
- func GetAppRunId() string
- func Init(appName string, cfgParam *config.Config) (bool, error)
- func Log(str string)
- func Logf(format string, args ...any)
- func MakeLogStream(name string) io.Writer
- func OrigStderr() *os.File
- func OrigStdout() *os.File
- func OutrigVersion() string
- func Shutdown()
- type Config
- type GoRoutine
- type Pusher
- type Watch
- func (w *Watch) AsCounter() *Watch
- func (w *Watch) AsGoFmt() *Watch
- func (w *Watch) AsJSON() *Watch
- func (w *Watch) AsStringer() *Watch
- func (w *Watch) ForPush() *Pusher
- func (w *Watch) PollAtomic(val any) *Watch
- func (w *Watch) PollFunc(fn any) *Watch
- func (w *Watch) PollSync(lock sync.Locker, val any) *Watch
- func (w *Watch) Static(val any) *Watch
- func (w *Watch) Unregister()
- func (w *Watch) WithTags(tags ...string) *Watch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppDone ¶
func AppDone()
AppDone signals that the application is done This should be deferred in the program's main function
func DefaultConfig ¶
DefaultConfig returns the default configuration
func GetAppRunId ¶
func GetAppRunId() string
GetAppRunId returns the unique identifier for the current application run
func Log ¶ added in v0.4.2
func Log(str string)
Log sends a simple string message to the Outrig logger
func MakeLogStream ¶ added in v0.5.0
MakeLogStream creates an io.Writer that sends written data as log lines to Outrig The name parameter specifies the source of the logs This log stream will never block your code for I/O. When Outrig is disabled, it discards the data after a simple atomic.Bool check (nanoseconds). When Outrig is enabled it uses a non-blocking write to a buffered channel.
func OrigStderr ¶
OrigStderr returns the original stderr stream that was captured during initialization
func OrigStdout ¶
OrigStdout returns the original stdout stream that was captured during initialization
Types ¶
type GoRoutine ¶ added in v0.5.2
type GoRoutine struct {
// contains filtered or unexported fields
}
func CurrentGR ¶ added in v0.5.2
func CurrentGR() *GoRoutine
CurrentGR returns a GoRoutine for the current goroutine. If the goroutine is already registered, it returns the existing declaration. Otherwise, it creates a new one and registers it.
func SetGoRoutineName ¶
SetGoRoutineName sets a name for the current goroutine
func (*GoRoutine) WithoutRecover ¶ added in v0.5.2
type Pusher ¶ added in v0.5.0
type Pusher struct {
// contains filtered or unexported fields
}
func (*Pusher) Unregister ¶ added in v0.5.0
func (p *Pusher) Unregister()
Unregister unregisters the pusher's watch from the watch collector
type Watch ¶ added in v0.5.0
type Watch struct {
// contains filtered or unexported fields
}
func (*Watch) AsStringer ¶ added in v0.5.0
func (*Watch) PollAtomic ¶ added in v0.5.0
PollAtomic sets up an atomic-based watch that reads values from atomic variables. This method is optimized for monitoring values that are updated using atomic operations.
The val parameter must be:
- A non-nil pointer
- A pointer to one of the following types:
- sync/atomic package types (atomic.Bool, atomic.Int32, atomic.Int64, etc.)
- Primitive types that support atomic operations (int32, int64, uint32, uint64, uintptr)
- unsafe.Pointer
Example:
var counter atomic.Int64 outrig.NewWatch("atomic-counter").PollAtomic(&counter)
func (*Watch) PollFunc ¶ added in v0.5.0
PollFunc sets up a function-based watch that periodically calls the provided function to retrieve its current value. The provided function must take no arguments and must return exactly one value (of any type).
Requirements for fn:
- Non-nil function
- Zero arguments
- Exactly one return value
Example:
outrig.NewWatch("counter").PollFunc(func() int { return myCounter })
func (*Watch) PollSync ¶ added in v0.5.0
PollSync sets up a synchronization-based watch to monitor values protected by a mutex or other locker. It's intended for values updated concurrently, ensuring thread-safe access during polling.
Requirements:
- lock: A non-nil sync.Locker (e.g., *sync.Mutex, *sync.RWMutex)
- val: A non-nil pointer to the value being watched
Example:
var mu sync.Mutex var counter int outrig.NewWatch("sync-counter").PollSync(&mu, &counter)
func (*Watch) Static ¶ added in v0.7.0
Static sets up a static watch that holds a constant value. The value is set once when the watch is created and never changes. This is useful for configuration values, URLs, or other constants that you want to monitor but don't need to poll.
Example:
outrig.NewWatch("game-url").Static("http://localhost:8080")
func (*Watch) Unregister ¶ added in v0.5.0
func (w *Watch) Unregister()
Unregister unregisters the watch from the watch collector
Directories
¶
Path | Synopsis |
---|---|
Package autoinit provides automatic initialization of Outrig when imported.
|
Package autoinit provides automatic initialization of Outrig when imported. |
pkg
|
|
collector/loginitex
Package loginitex provides external process-based log capture functionality
|
Package loginitex provides external process-based log capture functionality |
ds
Package ds provides data structures, types, and constants used over the wire between the SDK and the server
|
Package ds provides data structures, types, and constants used over the wire between the SDK and the server |
ioutrig
internal outrig package (used to get around circular references for internal outrig SDK calls)
|
internal outrig package (used to get around circular references for internal outrig SDK calls) |
server
module
|