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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

@richard-stafflink richard-stafflink Mar 26, 2024

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

// Or perhaps just:
// function createStream(config: PinoSeq.SeqConfig): Writable & { flushBuffer: () => void };
}

export = PinoSeq;