Skip to content

Commit

Permalink
bump to le_node and emit errors from the stream
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Whalley committed Jun 19, 2015
1 parent 8ee595f commit 22e15c7
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 668 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -12,3 +12,5 @@ logs
results

npm-debug.log

node_modules
31 changes: 31 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,31 @@
# logentries-stream is an [OPEN Open Source Project](http://openopensource.org/)

-----------------------------------------

## What?

Individuals making significant and valuable contributions are given
commit-access to the project to contribute as they see fit. This project
is more like an open wiki than a standard guarded open source project.

## Rules

There are a few basic ground-rules for contributors:

1. **No `--force` pushes** or modifying the Git history in any way.
1. **Non-master branches** ought to be used for ongoing work.
1. **External API changes and significant modifications** ought to be subject to an **internal pull-request** to solicit feedback from other contributors.
1. Internal pull-requests to solicit feedback are *encouraged* for any other non-trivial contribution but left to the discretion of the contributor.
1. Contributors should attempt to adhere to the prevailing code-style.

## Releases

Declaring formal releases remains the prerogative of the project maintainer.

## Changes to this arrangement

This is an experiment and feedback is welcome! This document may also be
subject to pull-requests or changes by contributors where you believe
you have something valuable to add or change.

Get a copy of this manifesto as [markdown](https://raw.githubusercontent.com/openopensource/openopensource.github.io/master/Readme.md) and use it in your own projects.
21 changes: 21 additions & 0 deletions LICENCE
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 anton whalley

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
30 changes: 9 additions & 21 deletions README.md
@@ -1,6 +1,7 @@
# logentries-stream

Stream interface for logentries
Simple Stream interface for logentries based on https://github.com/logentries/le_node
Please see that project for account creation and configuration for log keys etc.

## Prerequisites
[A logentries account](www.logentries.com)
Expand All @@ -12,27 +13,14 @@ npm install logentries-stream

## Usage

### Simple

```
var logstream = require('logentries-stream')('LOGENTRIES_TOKEN', 'LOG_LEVEL');
logstream.write('Hello World');
```
// Create a stream per log level
var logstream = require('logentries-stream')('LOG_TOKEN', 'LOG_LEVEL');
### With Bunyan

```
npm install bunyan
npm install logentries-stream
```

Sample Code

```
var Logger = require('bunyan');
var loglevel = 'info';
var logstream = require('logentries-stream')('LOGENTRIES_TOKEN', loglevel);
var log = new Logger({name: "myapp", stream: logstream, level: loglevel});
logstream.write('Hello World');
log.info('bunyan FTW');
// Log to stderr in case of connection issues.
logtream.on('error', function(err) {
process.stderr(err)
})
```
10 changes: 7 additions & 3 deletions index.js
@@ -1,8 +1,8 @@
var Stream = require('stream').Stream;
var logentries = require('node-logentries')
var Logger = require('le_node')

module.exports = function(token, level){
var log = logentries.logger({
var log = new Logger({
token: token
})

Expand All @@ -23,6 +23,10 @@ module.exports = function(token, level){
stream.destroy = function () {
stream.writable = false;
};


log.on('error', function (err) {
stream.emit('error', err);
})

return stream;
}

0 comments on commit 22e15c7

Please sign in to comment.