Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
57 lines (38 sloc) 1.22 KB
layout title description permalink
Event logging
Event logging


This mechanism allows you to track important events happening in your code. You can also subscribe to a specific event to receive an email every time it occurs.

For example:

  • A new user has registered
  • A new email has been sent
  • A robot has finished its jobs and you want to know what happened

Event Interface


You first need to install pmx, the prototype is then as simple as that:

pmx.emit(EVENT_NAME, DATA)

EVENT_NAME must be a string. DATA can be an object (an array will not work) or a string.

Example #1: User registration

var pmx = require('pmx');

pmx.emit('user:register', {
  user : 'Alex registered',
  email : ''

Example #2: Content creation

var pmx = require('pmx');

pmx.emit('content:page:created', 'A new page has been created');

Subscribe to an event by email

To subscribe to an event just click on "Subscribe by mail to this event":

Subscribe Event Interface