wedvich / structured-log-seq-sink Goto Github PK
View Code? Open in Web Editor NEWA structured-log plugin that writes log events to Seq.
License: MIT License
A structured-log plugin that writes log events to Seq.
License: MIT License
There are currently no type definitions for this project to use in Typescript.
structured-log
puts exceptions in the LogEvent
's error
field. This should be pushed to Seq's Exception
field.
We are currently using the window.onunhandledrejection
function to log any unhandled rejected promises within our code.
The issue we are seeing is that structured-log-seq-sink is not handling any of it's internal promises being rejected, thus causing the window.onunhandledrejection
to be raised.
This is causing a infinite loop for us as when the seq server is not available, the fetch promise fails, causing an window.onunhandledrejection
event to raised, which we handle and then try to log the error and the cycle continues.
Here is some example code to reproduce the issue
var structuredLog = require('structured-log');
var seqSink = require('structured-log-seq-sink');
var logger = structuredLog.configure()
.writeTo(seqSink({ url: "http://INVALID_URL_TO_SIMULATE_SEQ_NOT_AVAILABLE" }))
.writeTo(new structuredLog.ConsoleSink())
.create();
window.onunhandledrejection = (event) => {
logger.error(
'A window.onunhandledrejection exception occured: {errorMessage}',
event.reason ? event.reason.message : null
)
return false
}
logger.info('this causes an infinite loop')
While we can write code to work around the issue, I believe the solution is to swallow any exceptions that occur within the sink. Especially given that we are never given access to the fetch promise to handle ourselves.
Thoughts?
When using an API key to send events , the minimum accepted level for events can be set for that API key in Seq. A header is returned in the HTTP response with the minimum supported level when logging. This sink could use an internal minimum level filter that's updated by whatever Seq gives it.
Changelog would be great.
At least for future changes.
Instead of sending events as soon as they arrive, it would be beneficial to batch them and send them at regular intervals to reduce the number of HTTP requests.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.