jasbrake / actionfps-log-stream Goto Github PK
View Code? Open in Web Editor NEWStreams the logs served by ActionFPS using EventSource to a file.
Streams the logs served by ActionFPS using EventSource to a file.
So that I can run it with:
$ npm install -g actionfps-log-stream
$ AUTHORIZATION="..." actionfps-log-stream log-file.tsv
Depends on #1
2017-09-27 02:27 +00:00: Error: write after end
at writeAfterEnd (_stream_writable.js:234:12)
at WriteStream.Writable.write (_stream_writable.js:285:5)
at EventSource.eventSource.addEventListener (/usr/lib/node_modules/actionfps-log-stream/actionfps-log-stream.js:48:17)
at emitOne (events.js:115:13)
at EventSource.emit (events.js:210:7)
at _emit (/usr/lib/node_modules/actionfps-log-stream/node_modules/eventsource/lib/eventsource.js:222:17)
at parseEventStreamLine (/usr/lib/node_modules/actionfps-log-stream/node_modules/eventsource/lib/eventsource.js:237:9)
at IncomingMessage.<anonymous> (/usr/lib/node_modules/actionfps-log-stream/node_modules/eventsource/lib/eventsource.js:200:11)
at emitOne (events.js:115:13)
at IncomingMessage.emit (events.js:210:7)
I think the issue is that I am ending the writeStream on an error event from the eventsource server.
You look for the latest line to find the time.
When reading from the stream it'll read from that specific time onward - which could mean quite a few duplicate messages.
However, reading 'after' that time is not good either because there may be some messages that were missed.
Use the approach here:
https://github.com/ScalaWilliam/ActionFPS/blob/master/log-server/actionfps-log-sync.sh#L21-L26
So that the user wouldn't need to modify config.js and so that publishing to npmjs would yield a self contained package.
Most important config option is AUTHORIZATION.
logFilePath on the other hand is an argument and not configuration (you can have multiple log files, but only one auth token typically).
If you call the program without a file parameter, it will try to resolve the filepath of '' (empty string) and fail.
It should: let the user know that they need to pass in a file path as a parameter in order to run it.
Similarly, I need to decide whether it is best to leave File not found errors unhandled, or print a friendly error message and exit.
As per this comment, I need to split by the tab character.
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.