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

@temboplus/loggerlike

v1.0.0

Published

Standard interfaces for a logger component that can be implemented in different environments

Readme

@temboplus/loggerlike

A minimal TypeScript package that defines a standard logging interface for use across different environments. It provides no implementation — only the contracts that implementations must fulfill.

Installation

npm install @temboplus/loggerlike

Interfaces

LoggerLike

The core interface. Any logger you build or inject must implement this.

import { LoggerLike } from '@temboplus/loggerlike';

class MyLogger implements LoggerLike {
  child(options: ChildOptions): LoggerLike { ... }
  info(infoObject: InfoObject): void { ... }
  debug(infoObject: InfoObject): void { ... }
  warn(infoObject: InfoObject): void { ... }
  error(infoObject: InfoObject): void { ... }
}

InfoObject

The shape of every log entry. Requires a message field; any additional fields are allowed.

import { InfoObject } from '@temboplus/loggerlike';

const entry: InfoObject = {
  message: 'User created',
  userId: 42,
  role: 'admin',
};

ChildOptions

Passed to child() to create a scoped logger. Requires component and method; additional fields are allowed.

import { ChildOptions } from '@temboplus/loggerlike';

const options: ChildOptions = {
  component: 'AuthService',
  method: 'login',
};

ConsoleLogger

A development-ready implementation included for convenience. It writes structured entries to the native console and supports child loggers for scoped output.

import { ConsoleLogger } from '@temboplus/loggerlike';

const logger = new ConsoleLogger();

const child = logger.child({ component: 'AuthService', method: 'login' });

child.info({ message: 'User authenticated', userId: 42 });
// => { component: 'AuthService', method: 'login', message: 'User authenticated', userId: 42 }

child.warn({ message: 'Token expiring soon', expiresIn: 300 });
child.error({ message: 'Login failed', reason: 'Invalid password' });

Each log method maps to its native console equivalent:

| Method | Console call | |---------|-----------------| | info | console.log | | debug | console.debug | | warn | console.warn | | error | console.error |

NullLogger

A no-operation implementation that silently discards all log entries. Useful when a LoggerLike must be supplied but logging should be suppressed entirely.

import { NullLogger } from '@temboplus/loggerlike';

const logger = new NullLogger();
logger.info({ message: 'This is silently discarded' });

const child = logger.child({ component: 'MyService', method: 'run' });
child.error({ message: 'This is also discarded' });

Usage with dependency injection

The primary use case is typing a logger parameter against LoggerLike so any compliant implementation can be injected — including production loggers like Pino or Winston.

import { LoggerLike } from '@temboplus/loggerlike';

class UserService {
  private logger: LoggerLike;

  constructor(logger: LoggerLike) {
    this.logger = logger.child({ component: 'UserService', method: 'constructor' });
  }

  create(userId: number) {
    this.logger.info({ message: 'Creating user', userId });
  }
}

License

MIT