Expose logger from client
Summary: The `logger` was currently only available in a React context, and not directly exposed from the `client` API as well. This diff fixes it. The infrastructure including test stubs were present already, so the change is minimal. Reviewed By: nikoant Differential Revision: D28010120 fbshipit-source-id: cdd09ed236f5d92d07005d4e5a699360596281e4
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c89d18fd68
commit
844abca78c
@@ -16,6 +16,7 @@ import {Device, RealFlipperDevice} from './DevicePlugin';
|
||||
import {batched} from '../state/batch';
|
||||
import {Idler} from '../utils/Idler';
|
||||
import {Notification} from './Notification';
|
||||
import {Logger} from '../utils/Logger';
|
||||
|
||||
type StateExportHandler<T = any> = (
|
||||
idler: Idler,
|
||||
@@ -91,6 +92,11 @@ export interface BasePluginClient {
|
||||
* Writes text to the clipboard of the Operating System
|
||||
*/
|
||||
writeTextToClipboard(text: string): void;
|
||||
|
||||
/**
|
||||
* Logger instance that logs information to the console, but also to the internal logging (in FB only builds) and which can be used to track performance.
|
||||
*/
|
||||
logger: Logger;
|
||||
}
|
||||
|
||||
let currentPluginInstance: BasePluginInstance | undefined = undefined;
|
||||
@@ -284,6 +290,7 @@ export abstract class BasePluginInstance {
|
||||
showNotification: (notification: Notification) => {
|
||||
this.flipperLib.showNotification(this.pluginKey, notification);
|
||||
},
|
||||
logger: this.flipperLib.logger,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -332,6 +332,11 @@ The gatekeepers are cached in `localStorage`. Therefore, you might get the cache
|
||||
|
||||
</FbInternalOnly>
|
||||
|
||||
#### `logger`
|
||||
|
||||
Logger instance that logs information to the console, but also to the internal logging (in FB only builds) and which can be used to track performance.
|
||||
See also [`useLogger`](#uselogger).
|
||||
|
||||
## DevicePluginClient
|
||||
|
||||
### Properties
|
||||
|
||||
Reference in New Issue
Block a user