log

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Rendered for js/wasm

Overview

Package log contains shared logging code

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DOM added in v1.2.0

type DOM interface {
	QuerySelector(query string) js.Value
	SetChecked(query string, checked bool)
	FormatTime(utcSeconds int64) string
	CloneElement(query string) js.Value
	RegisterFuncs(ctx context.Context, wg *sync.WaitGroup, parentName string, jsFuncs map[string]js.Func)
	NewJsFunc(fn func()) js.Func
}

DOM interacts with the page.

type Log

type Log struct {

	// TimeFunc is a function which should supply the current time since the unix epoch.
	// This is used for logging message timestamps
	TimeFunc func() int64
	// contains filtered or unexported fields
}

Log manages messages for the log div.

func New added in v1.2.0

func New(dom DOM, timeFunc func() int64) *Log

New creates a new socket.

func (*Log) Chat

func (l *Log) Chat(text string)

Chat logs an chat-styled message.

func (*Log) Clear

func (l *Log) Clear()

Clear clears the log.

func (*Log) Error

func (l *Log) Error(text string)

Error logs an error-styled message.

func (*Log) Info

func (l *Log) Info(text string)

Info logs an info-styled message.

func (*Log) InitDom

func (l *Log) InitDom(ctx context.Context, wg *sync.WaitGroup)

InitDom registers log dom functions.

func (*Log) Warning

func (l *Log) Warning(text string)

Warning logs an warning-styled message.

Jump to

Keyboard shortcuts

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