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 🙏

© 2024 – Pkg Stats / Ryan Hefner

syslogh

v1.2.1

Published

Log to the system's Syslog. Provides simple native bindings to <syslog.h> and syslog(3). Works on Node v0.10 up to v4.

Downloads

80

Readme

Syslogh.js

NPM version Build status

Syslogh.js is a library for logging to your system's Syslog (RFC 3164) from within Node.js. It provides simple native bindings to <syslog.h> and syslog(3). You're in luck, because it does not come with any bells and whistles. Intentionally. KISS, right?

Works with Node v0.10, v0.11, v0.12 and of course v4 (stable).
Using it in production with Monday Calendar, so will be kept up to date when new Node versions come out.

Installing

Install with: npm install syslogh

Using

Using Syslogh.js is similar to using syslog(3) from C/C++.
First use openlog with your app name (up to 255 characters), options and the facility:

var Syslogh = require("syslogh")
Syslogh.openlog("myapp", Syslogh.PID, Syslogh.LOCAL7)

Then, when logging, just pass in the severity and your message.
Just like with regular syslog(3), you can use sprintf style placeholders. Those internally use Node's built-in Util.format.

Syslogh.syslog(Syslogh.NOTICE, "Freeze-frame high-five.")
Syslogh.syslog(Syslogh.NOTICE, "Phone %d.", 5)

You can also call Syslogh.closelog to close things down, but I'm not sure why you should bother. :-) Exiting your Node.js program will most likely shut everything down, too.

The syslog(3) manpage also talks about setlogmask to filter logs before they're sent. This isn't implemented. Not yet, at least.

Options

Options to pass to openlog come from <syslog.h>.

Option | Description -------|------------ CONS | Log to the system console on error. ODELAY | Delay open until syslog() is called. (Often default.) PID | Log the process ID with each message. NDELAY | Connect to syslog daemon immediately. NOWAIT | Don't wait for child processes.

Access them as constants. E.g. Syslogh.PID.
They form a bit mask, so to pass multiple of them to openlog, binary-OR them together with the | operator:

Syslogh.openlog("myapp", Syslogh.PID | Syslogh.NDELAY, Syslogh.LOCAL7)

Facilities

Facilities to pass to openlog come from <syslog.h> and (RFC 3164).
Some facilities might differ between systems. For your own app use, best stick to LOCAL* facilities.

Facility | Description ---------|------------ KERN | Kernel messages. USER | User-level messages. MAIL | Mail system. DAEMON | System daemons. AUTH | Security/authorization messages. SYSLOG | Messages generated internally by syslogd. LPR | Line printer subsystem. NEWS | Network news subsystem. UUCP | UUCP subsystem. CRON | Clock daemon. AUTHPRIV | Security/authorization messages. LOCAL0 | Local use 0. LOCAL1 | Local use 1. LOCAL2 | Local use 2. LOCAL3 | Local use 3. LOCAL4 | Local use 4. LOCAL5 | Local use 5. LOCAL6 | Local use 6. LOCAL7 | Local use 7.

Access them as constants. E.g. Syslogh.LOCAL7.

Severities

Severities to pass to syslog come from <syslog.h> and (RFC 3164).

Severity | Description ---------|------------ EMERG | System is unusable. ALERT | Action must be taken immediately. CRIT | Critical conditions. ERR | Error conditions. WARNING | Warning conditions. NOTICE | Normal but significant. INFO | Informational messages. DEBUG | Debug-level messages.

Access them as constants. E.g. Syslogh.NOTICE.

License

Syslogh.js is released under a Lesser GNU Affero General Public License, which in summary means:

  • You can use this program for no cost.
  • You can use this program for both personal and commercial reasons.
  • You do not have to share your own program's code which uses this program.
  • You have to share modifications (e.g. bug-fixes) you've made to this program.

For more convoluted language, see the LICENSE file.

About

Andri Möll typed this and the code.
Monday Calendar supported the engineering work.

If you find Syslogh.js needs improving, please don't hesitate to type to me now at [email protected] or create an issue online.