-
Notifications
You must be signed in to change notification settings - Fork 84
Revert remove type definitions #162
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
Conversation
5f2fd43
to
e2ae50a
Compare
Signed-off-by: Jonnatan Oyarzún <jonsxaero@gmail.com>
Hi @okkez. There is needed something else to merge? |
Winston support is optional. Because some users don't want to install winston npm package and they want to use this library with TypeScript. Therefore we cannot merge this PR. |
But it isn't necessary to install Winston to have the |
Ah... I got it. Sorry for my misunderstanding. I will test this PR and release new version ASAP. |
I've tested this PR with a simple script.
import winston from "winston";
import Fluent from "fluent-logger";
const config = {
host: 'localhost',
port: 24224,
timeout: 3.0,
requireAckResponse: true // Add this option to wait response from Fluentd certainly
};
// const fluentTransport = require('fluent-logger').support.winstonTransport();
const fluentTransport = Fluent.support.winstonTransport();
const logger = winston.createLogger({
transports: [new fluentTransport('mytag', config), new (winston.transports.Console)()]
});
logger.on('logging', (transport, _level, _message, meta) => {
if (meta.end && transport.sender && transport.sender.end) {
transport.sender.end();
}
});
logger.log('info', 'this log record is sent to fluent daemon');
logger.info('this log record is sent to fluent daemon');
logger.info('end of log message', { end: true }); In this case, we cannot resolve this error without importing winston possibly. |
Or, how about the following? diff --git a/lib/index.d.ts b/lib/index.d.ts
index c5a8943..040fe69 100644
--- a/lib/index.d.ts
+++ b/lib/index.d.ts
@@ -76,9 +76,9 @@ declare namespace fluentLogger {
static fromTimestamp(t: number): InnerEventTime;
}
- interface Constructable<T, U> {
- new(tag: string, options: U) : T;
- }
+ let support: {
+ winstonTransport: any
+ };
let EventTime: InnerEventTime;
|
Fix type definition based on #162
Relate to #161
This revert deleted lines of type definition related to Winston logger