Skip to main content
Home

A simple Deno logging library.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
70%
Published
2 years ago (1.1.0)

Waterlog

A logging library for Deno. Basically, a TS port of vala-console.

Usage

Waterlog provides the Logger class, which is used for all logging functionality. Import it this way:

$ deno add @asr/waterlog
import { Logger } from "@asr/waterlog"

To instantiate a Logger, use the new Logger(tag: string, isDebug?: boolean) constructor, where tag is the tag to use for logging (e.g. the routine name), and isDebug is whether to print debug messages (defaulting to false).

Then, you can log using the info, warn, err, and debug methods. Each takes a single argument, a message, which has to be a string. They then print it out with colors (run test.ts for an example). Messages from debug are only printed if isDebug is set to true.

Example

Taken from test.ts:

import { Logger } from "@asr/waterlog";

// Create a new Logger object, with a tag of 'mytag' and debug messages
var logger = new Logger("mytag", true);

// Print an info message
logger.info("Info");

// Print a warning message
logger.warn("Warning");

// Print an error message
logger.err("Error");

// Print a debug message
logger.debug("Debug");

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@asr/waterlog

Import symbol

import * as waterlog from "@asr/waterlog";
or

Import directly with a jsr specifier

import * as waterlog from "jsr:@asr/waterlog";

Add Package

pnpm i jsr:@asr/waterlog
or (using pnpm 10.8 or older)
pnpm dlx jsr add @asr/waterlog

Import symbol

import * as waterlog from "@asr/waterlog";

Add Package

yarn add jsr:@asr/waterlog
or (using Yarn 4.8 or older)
yarn dlx jsr add @asr/waterlog

Import symbol

import * as waterlog from "@asr/waterlog";

Add Package

vlt install jsr:@asr/waterlog

Import symbol

import * as waterlog from "@asr/waterlog";

Add Package

npx jsr add @asr/waterlog

Import symbol

import * as waterlog from "@asr/waterlog";

Add Package

bunx jsr add @asr/waterlog

Import symbol

import * as waterlog from "@asr/waterlog";