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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tv2media/logger

v2.1.0

Published

The framework aims to facilitate the logging needs of the developers in TV2 Udviklingsteknologi, as well as creating an uniform logging strategy across Typescript and Javascript projects.

Readme

MediaTech Logger

The framework aims to facilitate the logging needs of the developers in TV2 Udviklingsteknologi, as well as creating an uniform logging strategy across Typescript and Javascript projects.

The framework consists of 3 package:

  • @tv2media/logger contains all the common logic used by the two other packages. Note: previously this was the main package.
  • @tv2media/logger/node contains specializations of the common logic for a Node environment – e.g. logic for storing logs in a file or printing to the terminal console.
  • @tv2media/logger/web contains specializations of the common logic for a web browser environment – e.g. logic for sending logs over a WebSocket or printing to the developer console.

Install & build

The package can be installed by:

$ yarn add @tv2media/logger

To build from source:

$ git clone https://github.com/tv2/mediatech-logger.git
$ cd mediatech-logger
$ yarn && yarn build

Usage - Simple

import { DefaultLogger } from '@tv2media/logger/node'

const logger = new DefaultLogger()

logger.info('Server started.')
logger.error('Request failed.')
logger.data(new Error('Some dangerous error!')).error('Request failed.')

Usage - Advanced

import {
    LoggerBase, // The base class Logger for custom configuration.
    Level, // The severity of the the log
    Format, // Formatting type of the log
    ColoredPlainTextFormat, // Format for colored plain-text logs
    JsonFormat, // Format for json formatted logs
    Vault, // Where to store logs
    ConsoleVault // Vault for writing to console
} from '@tv2media/logger'

const logger = DefaultLogger(
  [
    new ConsoleVault({
      level: Level.INFO,
      format: ColoredPlainTextFormat(),
      isFormatLocked: false, // Format can be overwritten, e.g. by the EnvironmentLogger.
    }),
    new FileVault({
      level: Level.INFO,
      format: JsontFormat({ isPretty: false }),
      isFormatLocked: true, // Ensure that EnvironmentLogger doesn't overwrite the format.
    }),
  ],
  [
    (log) => ({ ...log, someExtraProperty: 'My extra property value' }), // Log enhancers can be used to enhance the log right before it is submitted to the vaults.
    (log) => ({ ...log, message: `Enhanced: ${log.message}` }) // They can also modify existing fields.
  ]
)

logger.data('some-data') // Adds the key-value pair { "data": "some-data" } to a new log context.
logger.tag('some-tag') // Adds the key-value pair { "tag": "some-tag" } to a new log context.
logger.error('Server failed.') // Stores a log context with severity level of 'error'.
logger.warn('No response from client.') // Stores a log context with severity level of 'warn'.
logger.info('Server started at ip:port') // Stores a log context with severity level of 'info'.
logger.debug({ip: '0.0.0.0'}) // Stores a log context with severity level of 'debug'.
logger.trace('some trace here') // Stores a log context with severity level of 'trace'.

logger.tag('testing').info('test message')
logger.info('message', {tag: 'testing', otherMeta: 'meta'}) // Each of the severity level methods takes an optional argument, with extra attributes for the log context.

logger.meta({hostname: 'host1', author: 'me'}) // Creates a new log context with the specified meta data.

logger.setLevel(Level.info) // Set the specified level for all vaults in the logger.

Environment Variables

@tv2media/logger/node

The DefaultLogger is using the environment variable NODE_ENV to determine which log level and format which will be used. The current setup is the following.

NODE_ENV=production            # format = JSON, log level = warn
NODE_ENV=stage | staging       # format = JSON, log level = info
NODE_ENV=develop | development # format = PLAINTEXT, log level = debug
NODE_ENV=local                 # format = PLAINTEXT, log level = trace
NODE_ENV="any other value"     # format = PLAINTEXT, log level = trace

Setting the environment variable LOG_LEVEL overrides the log level from the NODE_ENV setup, this can come in handy when you need to enable e.g. debugging logs in a production environment.

@tv2media/logger/web

The DefaultLogger is using the environment variable ENV to determine which log level and format which will be used. The current setup is the following.

window.env.ENV=production            # format = JSON, log level = warn
window.env.ENV=stage | staging       # format = JSON, log level = info
window.env.ENV=develop | development # format = PLAINTEXT, log level = debug
window.env.ENV=local                 # format = PLAINTEXT, log level = trace
window.env.ENV="any other value"     # format = PLAINTEXT, log level = trace

Setting the variable window.env.LOG_LEVEL overrides the log level from the window.env.ENV setup, this can come in handy when you need to enable e.g. debugging logs in a production environment.