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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mrlm/logz

v0.1.3

Published

Typescript RFC5424 logging package.

Downloads

7

Readme

mrlm-net/logz

Logging package following SysLog protocol - RFC 5424 written in Typescipt.

| Package | mrlm-net/logz | | :-- | :-- | | NPM name | @mrlm/logz | | NPM version | NPM Version | | Latest version | GitHub Release | | License | GitHub License |

Table of contents

Installation

I'm using YARN so examples will be using it, you can install this package via any Node Package Manager.

$ yarn add @mrlm/logz

Usage

import { Logger, LogLevel, LogOutput } from '@mrlm/logz';

const logger = new Logger({
    level: LogLevel.DEBUG,
    format: LogOutput.STRING,
    prefix: 'my-app'
});

logger.info('This is an info message');
logger.error('This is an error message', { errorCode: 123 });

Output:

[my-app] [2023-10-05T14:48:00.000Z] [INFO] This is an info message
[my-app] [2023-10-05T14:48:00.000Z] [ERROR] ["123"] This is an error message

Advanced Usage

Using Outputs

You can customize the logger to output logs to different destinations. For example, you can use the Console object to stream logs to a file.

import { Logger, LogLevel, LogOutput } from '@mrlm/logz';
import { Console } from 'console';
import { createWriteStream } from 'fs';

const output = createWriteStream('./stdout.log');
const errorOutput = createWriteStream('./stderr.log');
const loggerConsole = new Console({ stdout: output, stderr: errorOutput });

const logger = new Logger({
    level: LogLevel.DEBUG,
    format: LogOutput.STRING,
    outputs: [
        (level, message) => {
            if (level <= LogLevel.ERROR) {
                loggerConsole.error(message);
            } else {
                loggerConsole.log(message);
            }
        }
    ],
    prefix: 'my-app'
});

logger.info('This is an info message');
logger.error('This is an error message', { errorCode: 123 });

Output in stdout.log:

[my-app] [2023-10-05T14:48:00.000Z] [INFO] This is an info message

Output in stderr.log:

[my-app] [2023-10-05T14:48:00.000Z] [ERROR] ["123"] This is an error message

Interfaces

LogLevel

export enum LogLevel {
    EMERGENCY = 0,
    ALERT = 1,
    CRITICAL = 2,
    ERROR = 3,
    WARNING = 4,
    NOTICE = 5,
    INFO = 6,
    DEBUG = 7
}

LogOutput

export enum LogOutput {
    STRING = "string",
    JSON = "json"
}

LogOptions

export interface LogOptions {
    level?: LogLevel;
    format?: LogOutput;
    formatCallback?: (level: LogLevel, message: string, additionalInfo?: object) => string;
    outputs?: Array<(level: LogLevel, message: string) => void>;
    prefix?: string;
}

ILogger

export interface ILogger {
    log(level: LogLevel, message: string, additionalInfo?: object): void;
    emergency(message: string, additionalInfo?: object): void;
    alert(message: string, additionalInfo?: object): void;
    critical(message: string, additionalInfo?: object): void;
    error(message: string, additionalInfo?: object): void;
    warning(message: string, additionalInfo?: object): void;
    notice(message: string, additionalInfo?: object): void;
    info(message: string, additionalInfo?: object): void;
    debug(message: string, additionalInfo?: object): void;
}

Contributing

Contributions are welcomed and must follow Code of Conduct and common Contributions guidelines.

If you'd like to report security issue please follow security guidelines.


All rights reserved © Martin Hrášek <@marley-ma> and WANTED.solutions s.r.o. <@wanted-solutions>