Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including zoya with all npm packages installed. Try it out:

var zoya = require("zoya")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

zoya v1.0.0

Highly configurable logging utility

Truly highly composable logging utility written in TypeScript


Build Status Coverage Status NPM Downloads


Zoya is a highly composable logging library used for both client and server applications.

Visit the contributing guidelines to learn more on how to translate this document into more languages.

Come over to Discord or Twitter to share your thoughts on the project.

This is a complete rewrite of the awesome Signale from Klaus Siani, and it's NOT intended to be a drop-in replacement.


  • Easy to setup and compose as you like
  • Easy to control how things look
  • Easy to extend
  • Clean and beautiful output, configure as you wish
  • Supports JSON outputs
  • Extensible fields with several fields built in
    • Labels, Badge (emoji), Scopes, Level, Separators, Message, Context
  • Multiple configurable writable streams with stream level filtering
  • Simple and minimal syntax
  • Written in TypeScript




yarn add zoya


npm install zoya



Zoya tries to make it simple to configure and compose your loggers, so you can easily control how the output will look like. This is possible due to the field chain passed to the logger in its creation.

To use the default exported logger you just import and use it.

import zoya from "zoya";"Hello world!");

To see all the available examples check the examples folder

Default logger

The default export of zoya is an instance of a logger (called the default logger). This instance is preconfigured to write to process.stdout with all logging levels enabled (so you can use debug and trace for example).

These are all the available loggers in the default logger.

import log from "zoya";

log.trace("trace messages...");
log.debug("debug messages...");"info messages...");
log.warn("warn messages...");
log.error("error messages...");
log.fatal("fatal messages...");

The fields configured in the default logger are:


More on fields later.

On new instances

To create a new Zoya instance, use zoya function passing the proper configs you want. Note that all first level values uses the default values from the default logger, so you don't need to specify all of them if you want for example to just enable json logging.

Note that if you pass value to an object, for example types, all the child values are overwritten.

import { zoya, Level } from "zoya";

// Just enables json
const jsonLogger = zoya({ json: true });

// Only outputs to stderr
const stderrLogger = zoya({
  streams: [
      level: Level.error,
      stream: process.stderr

Enhancing loggers

Zoya allows you to enhance existing loggers in order to add new logging types. Enhancing logger will create a new logger instance and will keep the old logger intact.

import { bold, underline } from "chalk";
import log, { Level } from "zoya";

const xmasLogger = log.enhance({
  santa: {
    options: {
      badge: "santa"
      label: {
        name: "santa",
        transformer: label => bold(underline(label))
      scope: ["xmas"]


The above logger will output something like this

[xmas] » 🎅  santa Hohoho!



Zoya has the concept of fields. All log messages are built by a chain of fields that are configured when creating a new logger through zoya function. Fields are context sensitive, this means that you can output different things in a field depending on what the message contains.

Configuring fields

For example, if you just want to show the message and its context, you can configure zoya like this:

import { context, message, zoya } from "zoya";

const custom = zoya({
  fields: [message(), context()]
});"Hello world", { ip: "" });

This will output something like this in text mode:

Hello world {
  "ip": ""

And this in JSON mode:

{"message":"Hello world","context":{"ip":""}}

Zoya fields

Zoya contains several fields that can be imported from zoya package.


Used to display emojis in the log text


Displays the message context


Displays a customizable label for each message type


Adds the message level only on json outputs


Displays the message itself


Display the message scope(s)


Displays a customizable separator only in text mode

Custom fields

You can easily write custom fields.

TODO: write example custom fields. For now you can take the bundled ones as an example from here.


For more info on how to contribute to the project, please read the contributing guidelines.

  • Fork the repository and clone it to your machine
  • Navigate to your local fork: cd zoya
  • Install the project dependencies: npm install or yarn install
  • Lint code for errors: npm test or yarn test


  • Signale - Highly configurable logging utility



Why "Zoya"?

Because I like Trine :)



Huge thanks to brain (brain#4221), Micah (Micha#6878) and undefined.toString() (elderapo#8225) for the helpful insights over TypeScript discord channel




RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free