debug

package
v0.0.0-...-84602f5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Repository = "https://github.com/Jack-Gledhill/robojack"

Repository is a URL for the bot's source repository

Variables

View Source
var Build = &BuildInfo{
	DiscordGo: discordgo.VERSION,
	Gin:       gin.Version,
	Go:        runtime.Version(),
}

Build is populated at runtime with version information

View Source
var Git = &GitInfo{
	Commit: CommitInfo{
		Hash: defaultHash,
	},
	Ref:        getGitRef(),
	Repository: Repository,
}

Git is populated at runtime with source control information

View Source
var Runtime = RuntimeInfo{
	LogLevel:  log.Level.String(),
	Mode:      config.Mode(),
	StartTime: time.Now(),
}

Runtime is populated at runtime with information about the program's resource usage

View Source
var System = &SystemInfo{
	Arch:        runtime.GOARCH,
	LogicalCPUs: runtime.NumCPU(),
	OS:          runtime.GOOS,
}

System is populated at runtime with system information

Functions

This section is empty.

Types

type BuildInfo

type BuildInfo struct {
	DiscordGo string `json:"discordgo"`
	Gin       string `json:"gin"`
	Go        string `json:"golang"`
}

BuildInfo holds information about the packages this software was built with

type CommitInfo

type CommitInfo struct {
	Hash      string    `json:"hash"`
	Modified  bool      `json:"modified"`
	Timestamp time.Time `json:"timestamp"`
}

CommitInfo contains info about the current commit that the codebase is checked out as

type GitInfo

type GitInfo struct {
	Commit     CommitInfo `json:"commit"`
	Ref        string     `json:"ref"`
	Repository string     `json:"repository"`
}

GitInfo contains information about the version control state of the build This is useful for seeing the current state of the codebase

type RuntimeInfo

type RuntimeInfo struct {
	LogLevel  string    `json:"log_level"`
	Mode      string    `json:"mode"`
	StartTime time.Time `json:"start_time"`
}

RuntimeInfo holds info about the program's resource usage, uptime, log level and running environment

func (*RuntimeInfo) ActiveGoroutines

func (r *RuntimeInfo) ActiveGoroutines() int

ActiveGoroutines returns the number of goroutines that are currently alive

func (*RuntimeInfo) GCCycles

func (r *RuntimeInfo) GCCycles() uint32

GCCycles returns the number of completed garbage collector cycles since the program started

func (*RuntimeInfo) GCUsage

func (r *RuntimeInfo) GCUsage() int

GCUsage returns the % of CPU time used by the garbage collector since the program started

func (*RuntimeInfo) MemoryAllocated

func (r *RuntimeInfo) MemoryAllocated() uint64

MemoryAllocated returns the current size of the program's heap in bytes

func (*RuntimeInfo) Snapshot

func (r *RuntimeInfo) Snapshot() RuntimeSnapshot

Snapshot takes a snapshot of the program's resource usage when called

func (*RuntimeInfo) Uptime

func (r *RuntimeInfo) Uptime() time.Duration

Uptime calculates the duration of time the program has been running for

type RuntimeSnapshot

type RuntimeSnapshot struct {
	ActiveGoroutines int           `json:"active_goroutines"`
	GCCycles         uint32        `json:"gc_cycles"`
	GCUsage          int           `json:"gc_usage"`
	LogLevel         string        `json:"log_level"`
	MemoryAllocated  uint64        `json:"memory_allocated"`
	Mode             string        `json:"mode"`
	StartTime        time.Time     `json:"start_time"`
	Uptime           time.Duration `json:"uptime"`
}

RuntimeSnapshot is a snapshot of the results of RuntimeInfo's functions A snapshot can be taken by calling Runtime.Snapshot()

type SystemInfo

type SystemInfo struct {
	Arch        string `json:"arch"`
	LogicalCPUs int    `json:"logical_cpus"`
	OS          string `json:"os"`
}

SystemInfo contains information about the system the program is currently running on

func (*SystemInfo) IsLinux

func (s *SystemInfo) IsLinux() bool

IsLinux returns true if running on a Linux distro

func (*SystemInfo) IsMac

func (s *SystemInfo) IsMac() bool

IsMac is a helper function to check if the build is for macOS

func (*SystemInfo) IsWindows

func (s *SystemInfo) IsWindows() bool

IsWindows will return true if the current OS is detected as windows

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL