mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 07:17:04 +00:00
Merge pull request #24480 from clementallen/master
[sumo-logger] - Added methods and config options from new version
This commit is contained in:
Vendored
+22
-1
@@ -1,6 +1,7 @@
|
||||
// Type definitions for js-logging-sdk 1.0
|
||||
// Type definitions for js-logging-sdk 1.3
|
||||
// Project: https://github.com/SumoLogic/js-logging-sdk
|
||||
// Definitions by: forabi <https://github.com/forabi>
|
||||
// clementallen <https://github.com/clementallen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -67,6 +68,11 @@ declare namespace SumoLogger {
|
||||
* This value sets the Source Name for the logged message.
|
||||
*/
|
||||
sourceName?: string;
|
||||
|
||||
/**
|
||||
* This value enabled and disables sending data as graphite metrics
|
||||
*/
|
||||
graphite?: boolean;
|
||||
}
|
||||
|
||||
interface PerMessageOptions {
|
||||
@@ -124,6 +130,21 @@ declare class SumoLogger {
|
||||
* messages are sent to Sumo Logic.
|
||||
*/
|
||||
flushLogs(): void;
|
||||
|
||||
/**
|
||||
* Stop sending batched logs
|
||||
*/
|
||||
stopLogSending(): void;
|
||||
|
||||
/**
|
||||
* Start sending batched logs at the preconfigured interval
|
||||
*/
|
||||
startLogSending(): void;
|
||||
|
||||
/**
|
||||
* Empty the current queue of logs
|
||||
*/
|
||||
emptyLogQueue(): void;
|
||||
}
|
||||
|
||||
export = SumoLogger;
|
||||
|
||||
@@ -6,14 +6,15 @@ const onSuccessSpy = expect.createSpy();
|
||||
|
||||
const logger = new SumoLogger({
|
||||
endpoint: 'http://example.com/',
|
||||
onSuccess() {
|
||||
console.log('success');
|
||||
},
|
||||
onSuccess: onSuccessSpy,
|
||||
onError: onErrorSpy,
|
||||
});
|
||||
|
||||
expect(logger.flushLogs).toExist();
|
||||
expect(logger.log).toExist();
|
||||
expect(logger.emptyLogQueue).toExist();
|
||||
expect(logger.startLogSending).toExist();
|
||||
expect(logger.stopLogSending).toExist();
|
||||
|
||||
logger.log('message');
|
||||
logger.log({ json: 'object' });
|
||||
|
||||
Reference in New Issue
Block a user