Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tiny-track

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiny-track

A minimalistic dependency free logger

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

Tiny Track

npm version

A minimalistic dependency free logger that supports the transport of logs into multiple streams, and can also work both in the browser and in nodejs environments.

Besides, it provides other minimalistic approach to use logger through using tagged template:

import { tinyTrack } from 'tiny-track';

// One stream
const tt = tinyTrack({
    colorize: true,
    format: 'json',
    stream: process.stdout
}})

Where tt is Tagged Template, which can take any numbers of placeholders with data you want to log.

Pretty format example

pretty format demo

JSON format example

json format demo

Install

npm install tiny-track

Usage

import { tinyTrack } from 'tiny-track';

// One stream
const tt = tinyTrack({
    colorize: true,
    format: 'json',
    stream: process.stdout
}})

// Or multiple streams

const tt = tinyTrack([
  { colorize: true, stream: process.stdout, format: 'pretty', maxDepth: 5 },
  {
    level: ['debug', 'warn'],
    colorize: false,
    stream: fs.createWriteStream(path.resolve(process.cwd(), 'debug.log')),
  },
  {
    level: 'error',
    colorize: false,
    stream: fs.createWriteStream(path.resolve(process.cwd(), 'error.log')),
  },
])

// Browser compatible logger

const tt = tinyTrack({
    colorize: false,
    format: 'json', // or 'pretty'
}})

Log Levels

There are 4 log levels

  • info (default) - tt\[...]``
  • error - tt\![...]`, The exclamation mark !` at the beginning indicates that is error
  • wann - tt\w![...]`, The message should start with w!`
  • debug - tt\d![...]`, The message should start with d!`

Keywords

FAQs

Package last updated on 14 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc