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

@logtape/windows-eventlog

v2.0.4

Published

Windows Event Log sink for LogTape

Readme

LogTape Windows Event Log sink

JSR npm

Windows Event Log sink for LogTape. This package provides a Windows Event Log sink that sends log messages directly to the Windows Event Log system with cross-runtime support and optimal performance.

Features

  • Native Windows integration: Direct integration with Windows Event Log system
  • Cross-runtime: Works on Deno, Node.js, and Bun
  • High performance: Uses runtime-optimized FFI implementations
  • Structured logging: Preserves structured data in Event Log entries
  • Unicode support: Full support for international characters and emoji
  • Platform safety: Automatically restricts installation to Windows platforms
  • Zero dependencies: No external dependencies for Deno and Bun

Installation

This package is available on JSR and npm. You can install it for various JavaScript runtimes and package managers:

deno add jsr:@logtape/windows-eventlog  # for Deno
npm  add     @logtape/windows-eventlog  # for npm
pnpm add     @logtape/windows-eventlog  # for pnpm
yarn add     @logtape/windows-eventlog  # for Yarn
bun  add     @logtape/windows-eventlog  # for Bun

[!NOTE] This package is only available for Windows platforms. The package installation is restricted to Windows ("os": ["win32"]) to prevent accidental usage on other platforms.

Usage

The quickest way to get started is to use the getWindowsEventLogSink() function with your application source name:

import { configure } from "@logtape/logtape";
import { getWindowsEventLogSink } from "@logtape/windows-eventlog";

await configure({
  sinks: {
    eventlog: getWindowsEventLogSink({
      sourceName: "MyApplication",
    }),
  },
  loggers: [
    { category: [], sinks: ["eventlog"], lowestLevel: "info" },
  ],
});

You can also customize the sink behavior with additional options:

import { configure } from "@logtape/logtape";
import { getWindowsEventLogSink } from "@logtape/windows-eventlog";

await configure({
  sinks: {
    eventlog: getWindowsEventLogSink({
      sourceName: "MyApplication",
      eventIdMapping: {
        error: 1001,
        warning: 2001,
        info: 3001,
      },
    }),
  },
  loggers: [
    { category: [], sinks: ["eventlog"], lowestLevel: "info" },
  ],
});

[!NOTE] The Windows Event Log sink always writes to the Application log. This is the standard location for application events and does not require administrator privileges.

[!NOTE] The event ID is used to lookup a string resource from a dynamic link library. If you do not register a library, “the system cannot open the file” will be printed as description in the Event Log regardless of the parameters passed.

If you want to log only the text supplied by the formatter into the event log, you can register the system generic string library using this command:

New-Item `
  -Path HKLM:\SYSTEM\CurrentControlSet\Services\EventLog\Application `
  -Name MyApplication `
  | New-ItemProperty `
    -Name EventMessageFile `
    -PropertyType ExpandString `
    -Value %SystemRoot%\System32\netmsg.dll

Replacing MyApplication with the name you passed as sourceName to the sink, and use the NELOG_OEM_Code (the default) as the event ID. Note that there is no quotation marks around the data part of that command, as this trips up the escaping of the percentage signs.

[!NOTE] Event Viewer will cache the event message file when it is open. If you change the entry in the registry, it will not be updated until Event Viewer is restarted.

Runtime support

The Windows Event Log sink works across multiple JavaScript runtimes on Windows:

Viewing logs

Once your application writes to the Windows Event Log, you can view the logs using:

  • Event Viewer (eventvwr.msc)
  • PowerShell: Get-WinEvent -FilterHashtable @{LogName='Application'; ProviderName='MyApplication'}
  • Command Prompt: wevtutil qe Application /f:text /q:"*[System[Provider[@Name='MyApplication']]]"

Docs

The docs of this package is available at https://logtape.org/sinks/windows-eventlog. For the API references, see https://jsr.io/@logtape/windows-eventlog.