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

timbur

v1.0.0

Published

NodeJS logging library

Downloads

12

Readme

⚠️ This is a fun little project I made to get back into coding again after a while. DO NOT USE IT IN ANYTHING SERIOUS. You can play around it if you want. Thank you.

timbur

Timbur ( wordplay on timber, because its a "log"ging tool..get it ? no ? okay ) is a logging utility for nodejs

Features:

  • Asynchronous Logging with write streams
  • Automatic file rotation based on file size or time threshold.
  • Automatically detect origin of the log message
  • External buffer to ensure logs aren't lost while rotating files or during situation of backpressure from streams.
  • Log uncaught errors automatically before app crashes due to the same.
  • Graceful shutdown in case of process termination ensuring logs are not lost

Usage

Import the Logger class from the package and get the logger object

const { Logger } = require("timbur");
const logger = Logger.createLogger({
  //options
});

Options are configurations that you pass to the logger during its creation. Here's an example

const logger = Logger.createLogger({
  filePrefix: "DEMO_APP__",
  saveDirectoryPath: "logs/app-logs/",
});

The above example has two options:

filePrefix which tells the logger what the log file should be prefixed with

saveDirectioryPath is the directory location where the log files will be stored.

Options

Here is the complete list of options

| Option | Type |Description | Default Value | Note | |---|---|---|---|---| | level | Integer | Minimum log level; any log below this level will be ignored | 0 | ALL VALUES 0 : DEBUG 1 : INFO 2 : WARN 3 : ERROR 4 : CRITICAL | | filePrefix | String | File prefix for the log files which will be created | "" | | | filePostfix | String | File prefix for the log files which will be created | "" | | | logUncaughtExceptions | Boolean | Decides whether to log uncaught exceptions before the program stops due to the same | false | | | saveDirectoryPath | String | Path where the log files will be created; can be both an absolute path or a relative path (relative to the root of the project) | logs/ | If using relative path do not start the path with a / For example : logs/app-logs is valid while /logs/app-logs will be treated as an absolute path | | rollingTimeLimit | Integer | Time in seconds which taken from the creation of the current log file, which when passed will trigger a log file rotation | null(no rotation) | | | rollingFileSizeLimit | Integer | Max size of the contents of the log file which when exceeded will trigger a log file rotation | null(no rotation) | Do note that here the size refers to the size of content on the file and not the size on disk |

Logger singleton

Often when working with loggers you might want to share the same logger instance throughout multiple modules in your application. By default timbur doesn't have a singleton implementation out of the box but the same can be implemented by the user. Here is an example

// logger.js
const { Logger } = require('../src')

const logger = Logger.createLogger({
    filePrefix: 'DEMO_APP__',
    saveDirectoryPath: 'logs/app-logs/',
    logUncaughtExceptions : true,
    level : 1
})

module.exports = logger;

Here we have created a file named logger.js, this file can be imported by other modules which want to use logging. All the modules importing this particular file will have access to singular logger instance.

// index.js
const logger = require('./logger.js')
const {add, sub, multiply, divide} = require('./calc.js')


function main(){
    logger.warn("You are in main module");
    add(3, 5);
    sub(3, 5);
    multiply(21, 3);
    divide(-3, 4);
}

main()

Here index.js file uses the logger instance

//calc.js
const logger = require('./logger')

module.exports.add = (a, b) => {
    logger.info(a + b);
}

module.exports.sub = (a, b) => {
    logger.info(a - b);
}

module.exports.multiply = (a, b) => {
    logger.info(a * b);
}

module.exports.divide = async (a, b) => {
    logger.info(a / b);
}

The module calc.js has access to the same logger instance.

Hence we have achieved singleton logger functionality.