pquerna/node-logmagic — pull request #9 by Kami (2013-12-12 16:13:19+00:00)
Title: Update module so it can also be used in the browser

This pull request makes logmagic work in the browser.

I've ported it because I needed a good logging module which I can use in a Chrome extension and all of the existing ones which work in the browser are less than the ideal.

## Changes

This pull request includes the following changes:

* Split code into three directories
* `common/` - common / shared code which can be used in node and the browser
* `node/` - node specific code and exports
* `browser/` - browser specific code and exports
* Add `bower.json` file so this library can be installed as a bower component
* Update readme to include details on how to build a release and how to use library in the browser

## Differences between Node.js and browser version

Currently the only difference between the Node.js and browser version is that node version also exports `gelf` sink. The reason why browser module doesn't expose `gelf` sink is that `graylog` module relies in `os.hostname()` which is not available in the browser.

If we ever want to also expose `gelf` sink to the browser, it should be fairly easy to do that (we would just need to remove reference to `os.hostname()`).

## Backward compatibility

I have added `lib/logmagic.js` and `lib/graylog.js` shim so the changes should be fully backward compatible.

### Building the browser module

To build the browser module, you need to run `make build` command. This will create `dist/logmagic.js` file which can be used in the browser.

![](http://images2.wikia.nocookie.net/__cb20080329191652/uncyclopedia/images/3/31/Dancing_Banana.gif)