https://github.com/leostera/anchorman.js
a reporter library for nodejs
https://github.com/leostera/anchorman.js
Last synced: 9 months ago
JSON representation
a reporter library for nodejs
- Host: GitHub
- URL: https://github.com/leostera/anchorman.js
- Owner: leostera
- Created: 2013-06-30T15:35:21.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2013-09-21T09:19:51.000Z (almost 13 years ago)
- Last Synced: 2025-07-25T06:32:53.016Z (12 months ago)
- Language: JavaScript
- Homepage:
- Size: 121 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Anchorman
### a reporter library

### Motivation
I made this lib for SequelizeJS so they could easily hook up mocha reporters but it never happened. Dead small, dead simple and it works over events which is the way I considered best to be done. That's about the size of it.
### Usage
```js
// opts is an array of options
// that includes an eventemitter2 attribute
// for you to pass in ee2 params
var anchorman = require('anchorman')(opts);
// let's subscribe to some news
anchorman.on('someEvent', transports);
// now lets broadcast some news
anchorman.broadcast('someEvent', {some: 'data'});
// transports can be just a function
anchorman.on('someOtherEvent', function (data) {
console.log(data);
});
// transports can be objects that implement a publish function
var transportObject = {
someData: 'prefix:',
publish: function (data) {
console.log(someData,data);
}
};
anchorman.on('someOtherEvent', transportObject);
// or they can be an array of transport objects
var transportsArray = [
consoleTransport,
fileTransport,
emailTransport
];
anchorman.on('someEvent', transportsArray);
```