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

telemetry-events-log

v3.0.1

Published

Helper for creating and emitting telemetry log events.

Readme

telemetry-events-log

Stability: 2 - Stable

NPM version

Helper for creating and emitting TelemetryEvents for logs.

Contributors

@tristanls, @lpearson05

Contents

Installation

npm install telemetry-events-log

Usage

To run the below example run:

npm run readme
"use strict";

var events = require('events');
var pkg = require('../package.json');
var TelemetryEvents = require('telemetry-events');

var LogTelemetryEvents = require('../index.js');

var emitter = new events.EventEmitter();

var telemetryEvents = new TelemetryEvents({emitter: emitter, package: pkg});

var logTelemetry = new LogTelemetryEvents({telemetry: telemetryEvents});

emitter.on('telemetry', function (event) {
    console.dir(event);
});

logTelemetry.log('info', 'hello info level');
logTelemetry.log('warn', 'hello warn level');
logTelemetry.log('error', 'hello error with common data', {common: 'data'});

var _commonEventData = {
    method: "readme"
};
logTelemetry.log("info",
{
    common: "data with no message and no custom event data attached"
});
logTelemetry.log("info", _commonEventData,
{
    custom: "data with common and custom event data attached"
});
logTelemetry.log("info", "my message", _commonEventData,
{
    custom: "data with message and common and custom event data attached"
});

Tests

npm test

Documentation

LogTelemetryEvents

Public API

new LogTelemetryEvents(config)

  • config: Object
    • telemetry: Object TelemetryEvents instance.
  • Return: Object Instance of LogTelemetryEvents.

Creates a new LogTelemetryEvents instance.

telemetry.log(level, [message], [common], [custom])

  • level: String Log level to be used for event.level property.
  • message: String (Default: undefined) An optional message to be used for event.message property.
  • common: Object (Default: undefined) Optional common event data to clone and extend with the event data.
  • custom: Object (Default: undefined) Optional object with custom properties to add to the event.
  • Return: Object The event.

Helper to create and emit a "log" event. The created event will have the following properties in addition to those included by TelemetryEvents.

{
    type: 'log',
    level: <level>,
    message: <message> // if provided
}

Any property of custom Object will be attached to the above event template. You can also use custom to override any of the above properties.

Releases

We follow semantic versioning policy (see: semver.org):

Given a version number MAJOR.MINOR.PATCH, increment the:

MAJOR version when you make incompatible API changes, MINOR version when you add functionality in a backwards-compatible manner, and PATCH version when you make backwards-compatible bug fixes.