npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@epegzz/winston-dev-console

v1.3.4

Published

Winston@3 console format aimed to improve development UX

Downloads

2,937

Readme

winston-dev-console

A Winston@3 console format for development (based on winston-console-format) that aims to improve NodeJS development UX by

  • adding the source of the logging statement to the log output
  • optimizing readability of each log statement through log statement separation, output colorization and arg pretty printing

Demo

Real world screenshot:

Install

npm install winston @epegzz/winston-dev-console

or

yarn add winston @epegzz/winston-dev-console

Usage TypeScript

import { createLogger, format, transports } from "winston";
import winstonDevConsole from "@epegzz/winston-dev-console";
import util from "util";

let log = createLogger({
  level: "silly", // or use process.env.LOG_LEVEL
});

// Note: You probably only want to use winstonDevConsole during development
log = winstonDevConsole.init(log);
log.add(
  winstonDevConsole.transport({
    showTimestamps: false,
    addLineSeparation: true,
  })
);

log.silly("Logging initialized");
log.debug("Debug an object", { make: "Ford", model: "Mustang", year: 1969 });
log.verbose("Returned value", { value: util.format });
log.info("Information", {
  options: ["Lorem ipsum", "dolor sit amet"],
  values: ["Donec augue eros, ultrices."],
});
log.warn("Warning");
log.error(new Error("Unexpected error"));

Usage JavaScript

const { createLogger, format, transports } = require("winston");
const winstonDevConsole = require("@epegzz/winston-dev-console").default;
const util = require("util");

let log = createLogger({
  level: "silly", // or use process.env.LOG_LEVEL
});

// Note: You probably only want to use winstonDevConsole during development
log = winstonDevConsole.init(log);
log.add(
  winstonDevConsole.transport({
    showTimestamps: false,
    addLineSeparation: true,
  })
);

log.silly("Logging initialized");
log.debug("Debug an object", { make: "Ford", model: "Mustang", year: 1969 });
log.verbose("Returned value", { value: util.format });
log.info("Information", {
  options: ["Lorem ipsum", "dolor sit amet"],
  values: ["Donec augue eros, ultrices."],
});
log.warn("Warning");
log.error(new Error("Unexpected error"));

API

winstonDevConsole.format(options)

options

Configuration object.Type: DevConsoleFormatOptions

options.inspectOptions

util.inspect() configuration object. Type: Object

options.basePath

Used to remove the base path of the project when showing the file path of the log statement. By default anything in the path before (and including) the src folder will be removed. Type: String

options.addLineSeparation

Wheather or not to separate each log statement with a blank line. Type: Boolean Default: true

options.showTimestamps

Wheather or not to show timestamps During development the timestamps are usually more noise then helpful, therefore disabled by default. Type: Boolean Default: false

Acknowledgements

This project is inspired by and partly shamelessly copied from winston-console-format