Comments (5)
winston allows transports to handle uncaught exceptions. The Amazon-SNS and Graylog2 transports are examples that handle this. In node, especially, unhandled exception handling is critical because it's not compiled, strongly typed, and exception handling is "hard" to get right. Alerts on uncaught exceptions are almost necessary even with robust unit test coverage.
If winston-logsene handled uncaught exceptions, I wouldn't need to separate those exceptions out to their own log and tail them with logstash.
from winston-logsene.
Big +1. We've been wanting to capture exceptions automatically.
from winston-logsene.
This should work now in 1.0.9:
var winston = require('winston')
var Logsene = require('winston-logsene')
var logger = new winston.Logger()
logger.add(Logsene, {
token: process.env.LOGSENE_TOKEN,
handleExceptions: true,
exitOnError: false})
BTW: Logstash? ;) Check out https://github.com/sematext/logagent-js
from winston-logsene.
Here's a hack to emulate exitOnError:true
var winston = require('winston');
var winstonLogsene = require('winston-logsene');
var logseneInstance;
var logger = new winston.Logger({
transports: [
new winston.transports.Console({
colorize: true,
handleExceptions: false,
}),
logseneInstance = new winstonLogsene({
token: process.env.LOGSENE,
type: process.env.APP || 'api-unkown',
handleExceptions: false
})
]
});
process.on('uncaughtException', function (err) {
logger.error(err.stack || err.toString());
logseneInstance.logger.send(function() {
process.exit(1);
});
});
from winston-logsene.
I think this can be closed.
from winston-logsene.
Related Issues (15)
- Add winston-logsene to winston Transports HOT 1
- Logs not shipped if the process is very short-lived HOT 6
- Does not send successfully unless I wait 30 seconds HOT 5
- Add instructions for EU instance HOT 5
- readme is out of date
- Update to work with Winston 3.x HOT 1
- Add a Native UI or Kibana 4 screenshot to README
- Major memory leak and crash because of "flat" dependency HOT 5
- Unhandled error when unreachable is causing crash HOT 5
- tags don't appear to be received properly HOT 9
- Update/remove vulnerable packages from npm
- Can't log exception instances HOT 11
- Memory leak and process.exit issue HOT 9
- Winston-logsene is modifying objects HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from winston-logsene.