@custody/plugin-log-notifier
Post a native notification when your process logs a relevant message
Last updated a year ago by wearhere .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @custody/plugin-log-notifier 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 1.0.0                                ...           latest (a year ago)

1 Versions

  • 1.0.0                                ...           a year ago
Downloads
Today 0
This Week 1
This Month 6
Last Day 1
Last Week 2
Last Month 2
Dependencies (2)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |