Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/hex/src/lib/mod.ts>stdx.log.handlers

An ecosystem delivering practices, philosophy and portability. Powered By Deno and JavaScript.
Latest
variable stdx.log.handlers
import { stdx } from "https://deno.land/x/hex@0.6.5/src/lib/mod.ts";
const { handlers } = stdx.log;

Handlers are responsible for actual output of log messages. When a handler is called by a logger, it firstly checks that LogRecord's level is not lower than level of the handler. If level check passes, handlers formats log record into string and outputs it to target.

Custom handlers

Custom handlers can be implemented by subclassing BaseHandler or WriterHandler.

BaseHandler is bare-bones handler that has no output logic at all,

WriterHandler is an abstract class that supports any target with Writer interface.

During setup async hooks setup and destroy are called, you can use them to open and close file/HTTP connection or any other action you might need.

For examples check source code of FileHandler`` and TestHandler`.

type

{ BaseHandler; ConsoleHandler; WriterHandler; FileHandler; RotatingFileHandler; }