lua

package
v0.0.4-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package lua exposes hex/log to Lua scripts as the "log" module.

local log = require("log")

log.info("hello",  { user = "alice" })
log.debug("query", { sql = "SELECT ..." })
log.warn("slow",   { ms = 823 })
log.error("boom",  { err = tostring(err) })

The optional second argument is a table of key/value attributes, forwarded to slog / hex/log as structured fields. Keys should be strings; values are converted with the same rules used by hex/db/lua and hex/config/lua (numbers, strings, bools, nil, nested tables become their string form).

The module delegates to hex/log's package-level functions, which in turn use slog.Default. This lets tests swap the global handler via slog.SetDefault and see Lua-side log calls captured.

Index

Constants

This section is empty.

Variables

View Source
var TypeStub string

TypeStub is the Teal .d.tl source describing the `log` module.

Functions

This section is empty.

Types

type Bindings

type Bindings struct{}

Bindings is intentionally empty — the log module has no state to carry (slog.Default is a global). The type exists for symmetry with the other Lua bridges and to keep the Loader signature method-shaped.

func (*Bindings) Loader

func (b *Bindings) Loader(L *glua.LState) int

Loader is the gopher-lua LGFunction registered against env.PreloadModule("log", b.Loader).

Jump to

Keyboard shortcuts

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