-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
index.d.ts: Expose the flush method on the return type #36
base: dev
Are you sure you want to change the base?
Conversation
Related to this PR: #33 |
@@ -11,7 +11,9 @@ declare namespace PinoSeq { | |||
onError?: (e: Error) => void; | |||
} | |||
|
|||
function createStream(config: PinoSeq.SeqConfig): Writable; | |||
function createStream(config: PinoSeq.SeqConfig): Writable & { _logger: seq.Logger; flushBuffer: () => void }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this compile? I'm not sure where the seq.Logger
type is coming from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, flushBuffer
is not very useful. It pushes the log events to seq-logging
but they can still be buffered there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I used these comments locally (in my repo):
/** The underlying seq.Logger instance */
_logger: seq.Logger
/** Fire and forget async flush of the buffer, use _logger.flush() for a promise */
flushBuffer: () => void
@richard-stafflink would something like #37 get the job done? |
Yes, thanks @liammclennan |
@richard-stafflink #37 is merged and published as |
AWS lambdas will halt/freeze the Node process as soon as a result is returned.
So, in order to not lose log entries, the lambda should flush logs just before returning a result