Skip to main content
Module

x/gardens/lib/gardens.ts>default

A useful logging utility for JavaScript everywhere. 🎉
Latest
class default
import { default } from "https://deno.land/x/gardens@v4.2.0/lib/gardens.ts";

Constructors

new
default(
scope?: string,
options?: Partial<GardenOptions>,
_super?: Garden,
)

Properties

private
_counts: CountsObject
private
_super: Garden
private
_times: TimesObject
private
options: GardenOptions

Methods

private
_checkOptions(update: Partial<GardenOptions>)
private
_print(unnamed 0: PrintType, ...messages: any[])
private
_scopePrefix(outputType?): MessageContainer[]
private
_style(
text: string,
style?: CssObject,
outputType?,
): MessageContainer
private
_transform(output: MessageContainer[])
assert(value: any, ...messages: any[])
assert_eq(
given: any,
expected: any,
...messages: any[],
)
assertionerror(errorMessage: string, ...messages: any[])
bound(): BoundGarden

Returns a bound version of the garden, meaning that the methods do not need need to be directly attached to the garden to function properly.

For example, the following is how a typically garden would behave if you detached one of its methods and tried to use it.

const { debug } = gardens.createScope();
debug( 'Hello!' );
❌ TypeError: Cannot read property {...} of undefined "this".

A bound garden can be used that way with no problem!

const { debug } = gardens.createScope().bound();
debug( 'Hello!' );
→ [debug] Hello!

It's also worth noting that when using a [[Manager]], gardens bound by default.

const { debug } = manager.scope( 'x', 'y', 'z' );
debug( 'Hello!' );
→ [x][y][z][debug] Hello!
catch(errorMessage: Error | string, ...messages: any[]): Error
configure(update: Partial<GardenOptions>)
count(name: Name, ...messages: any[])
createManager(scope: string, options?: Partial<ManagerOptions>)
createScope(scope?: string, options?: Partial<GardenOptions>)
debug(...messages: any[])
deny(value: any, ...messages: any[])
error(errorMessage: string, ...messages: any[])
fail(...messages: any[])
failure(...messages: any[])
info(...messages: any[])
log(...messages: any[])
raw(...messages: any[])
referenceerror(errorMessage: string, ...messages: any[])
styled(message: string, style: CssObject)
success(...messages: any[])
throws(throws: () => never, ...messages: any[])
time(name: Name)
timeEnd(name: Name, ...messages: any[])
trace(errorMessage: string, ...messages: any[])
typeerror(errorMessage: string, ...messages: any[])
warn(...messages: any[])
warning(...messages: any[])

Static Methods

configureEnvironment(update: Partial<EnvironmentConfiguration>)