Fixing some problems with the adapter API

This commit is contained in:
Fabian Stamm
2020-04-09 18:00:59 +02:00
parent 94d9731cdd
commit 9182efe7e7
3 changed files with 41 additions and 9 deletions

View File

@ -107,13 +107,19 @@ export interface Message {
}
export interface Adapter {
init(
observable: ObservableInterface<Message>,
name?: string
): void | Promise<void>;
/**
* This function initialises the Adapter. It might be called multiple times, when added to multiple instances
* @param observable An observable to subscribe to messages
*/
init(observable: ObservableInterface<Message>): void | Promise<void>;
flush(sync: true): void;
flush(sync: false): void | Promise<void>;
/**
* When a close function is available, it will be called when no logging instance references it anymore.
*
* WARNING: The adapter might be reinitialised, when it is added to a new Logging instance
*/
close?(): void;
}