console

package
v0.0.0-...-e62627f Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package console provides Node-style console logging for QuickJS.

Index

Constants

View Source
const ModuleName = "console"

Variables

This section is empty.

Functions

func InstallGlobal

func InstallGlobal(ctx *quickjs.Context) error

InstallGlobal installs the default console on globalThis.console.

func InstallGlobalWithPrinter

func InstallGlobalWithPrinter(ctx *quickjs.Context, printer Printer) error

InstallGlobalWithPrinter installs a console using printer on globalThis.console.

func Module

func Module() module.Definition

Module returns the console and node:console ESM definition using the default printer.

func ModuleWithPrinter

func ModuleWithPrinter(printer Printer) module.Definition

ModuleWithPrinter returns a console ESM definition using printer.

Types

type Printer

type Printer interface {
	Log(string)
	Warn(string)
	Error(string)
}

Printer receives already-formatted console messages.

type StdPrinter

type StdPrinter struct {
	StdoutPrint func(string)
	StderrPrint func(string)
}

StdPrinter adapts output functions to Printer.

func (StdPrinter) Error

func (p StdPrinter) Error(message string)

func (StdPrinter) Log

func (p StdPrinter) Log(message string)

func (StdPrinter) Warn

func (p StdPrinter) Warn(message string)

Jump to

Keyboard shortcuts

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