Skip to content
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

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

richard-stafflink
Copy link

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

@richard-stafflink
Copy link
Author

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 };
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Author

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

@liammclennan
Copy link
Contributor

@richard-stafflink would something like #37 get the job done?

@richard-stafflink
Copy link
Author

@richard-stafflink would something like #37 get the job done?

Yes, thanks @liammclennan

@liammclennan
Copy link
Contributor

@richard-stafflink #37 is merged and published as pino-seq 1.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants