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

@custody/plugin-log-notifier

v1.0.0

Published

Post a native notification when your process logs a relevant message

Downloads

24

Readme

custody-plugin-log-notifier

As developers, we wish that we got immediate feedback to our changes. Sometimes, we don't:

This custody plugin can restore your focus by notifying you when your app logs certain messages. You might use this to notify you when your build finishes, by watching for "Finished '<name of Gulp task>'".

You might also use this to notify you of certain high-priority logs, whenever they occur—kind of like leaving a breakpoint in place, without actually having to set up the debugger or stop what you're doing when the point is hit. By watching for "^notify!", any log message you prefix with that phrase will result in a notification.

Clicking the notification will then bring custody to the fore.

Installation

npm install -g @custody/plugin-log-notifier

Make sure you also configure the plugin as in the next section.

Note that this only supports OS X at the moment.

Usage

Launch custody-cli settings and add "@custody/plugin-log-notifier" to your .custodyrc, with the patterns you'd like to watch. For the use cases described at the top of this README, you might do something like

{
  "plugins": [
    ["@custody/plugin-log-notifier", {
      "patterns": [
        "Finished 'js:gmail-inbox'",
        "^notify!"
      ]
    }]
  ]
}

The patterns are parsed as regular expressions.

Restart custody-cli to get it to pick up the new configuration. Repeat to make changes to the patterns.

After opening a process' details in custody, if and when a log message matches one of the patterns, it will then result in a notification:

You will only receive a notification if a process logs a match while you have its details open. If you'd like to support "background notifications" or notifications in the "maintail" view, please open an issue!

Clicking the body of the notification, or the "Show" button that appears on hover, will bring Terminal.app to the fore. If you use a different terminal app, specify it in custody settings like so:

{
  "plugins": [
    ["@custody/plugin-log-notifier", {
      "patterns": […],
      "terminal": "iTerm"
    }]
  ]
}

Related Projects

Packages like gulp-notify can integrate directly into the build process, to detect precisely when the build finishes, whereas this project reverse-engineers that sort of thing from the logs.

Some nice things about using this project are that:

  • it works regardless of build technology

  • you configure it once and it works across all the processes you have running in custody

  • it can notify on messages logged by your services, not just their build processes:

    custody
      - gulp (using gulp-nodemon) <-- gulp-notify notifies here
        - node                    <-- this project can notify here too

Lastly, using this project, individual developers can easily configure notifications for themselves without having to pass settings through to the build processes.

Contributing

We welcome bug reports and feature suggestions! In particular, we'd love for Windows and Linux support.