functions

package
v2.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Ignore = &IgnoreLogger{}

Functions

func JSON

func JSON(val otto.Value) string

JSON stringifies a value inside of the otto vm, yielding better results than Export for Object-like class such as Date, but being much slower.

func RunCode

func RunCode(name, code string, env map[string]interface{}, timeout time.Duration, logger Logger) (val otto.Value, err error)

Types

type EntryLogger

type EntryLogger struct {
	Logs []*pb_handler.LogEntry
	// contains filtered or unexported fields
}

console is a Logger that saves the logs as LogEntries

func NewEntryLogger

func NewEntryLogger() *EntryLogger

Console returns a new Logger that save the logs to

func (*EntryLogger) Enter

func (c *EntryLogger) Enter(function string)

func (*EntryLogger) Log

func (c *EntryLogger) Log(call otto.FunctionCall)

type IgnoreLogger

type IgnoreLogger struct{}

func (*IgnoreLogger) Enter

func (c *IgnoreLogger) Enter(function string)

func (*IgnoreLogger) Log

func (c *IgnoreLogger) Log(call otto.FunctionCall)

type Logger

type Logger interface {
	// Log passes the console.log function call to the logger
	Log(call otto.FunctionCall)

	// Enter tells the Logger what function it is currently in
	Enter(function string)
}

Logger is something that can be logged to, saving the logs for later use

Jump to

Keyboard shortcuts

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