Added 'node-loggly-bulk' package support (#40798)

* Added 'node-loggly-bulk' package support

* Fix LogglyBulkConstructor interface constructor
This commit is contained in:
Andrei Kazakou
2019-12-10 14:41:39 -05:00
committed by Orta
parent 7256a9b80d
commit cb8149a21d
4 changed files with 86 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
// Type definitions for node-loggly-bulk 2.2
// Project: https://github.com/loggly/node-loggly-bulk#readme
// Definitions by: Andrei Kazakou <https://github.com/akazakou>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { LogglyInstance, LogglyOptions } from 'loggly';
export interface LogglyBulkOptions extends LogglyOptions {
proxy?: any;
userAgent?: string;
useTagHeader?: boolean;
isBulk?: boolean;
bufferOptions?: {
size: number;
retriesInMilliSeconds: number;
};
networkErrorsOnConsole?: boolean;
}
export interface LogglyBulkConstructor {
new (options: LogglyBulkOptions): LogglyInstance;
}
export const Loggly: LogglyBulkConstructor;
export const version: string;
export function createClient(options: LogglyBulkOptions): LogglyInstance;
export function serialize(obj: any, key?: string): string;
@@ -0,0 +1,32 @@
import { createClient, Loggly, serialize } from 'node-loggly-bulk';
const client = createClient({
token: 'test-token',
subdomain: 'test-subdomain',
});
client.log('Test message');
client.log({ json: 'yes' }, ['some-tag'], () => {});
new Loggly({
token: 'YOUR_TOKEN',
subdomain: 'YOUR_DOMAIN',
tags: ['NodeJS'],
json: true,
auth: {
username: 'your-username',
password: 'your-password',
},
proxy: null,
userAgent: 'test-user-agent-header',
useTagHeader: true,
isBulk: true,
bufferOptions: {
size: 500,
retriesInMilliSeconds: 30000,
},
networkErrorsOnConsole: false,
});
serialize({ key: 'value' }, 'key');
serialize({ key: 'value' });
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"node-loggly-bulk-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }