本文整理匯總了TypeScript中@sentry/utils.logger類的典型用法代碼示例。如果您正苦於以下問題:TypeScript logger類的具體用法?TypeScript logger怎麽用?TypeScript logger使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了logger類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: showReportDialog
/**
* Show a report dialog to the user to send feedback to a specific event.
*
* @param options Set individual options for the dialog
*/
public showReportDialog(options: ReportDialogOptions = {}): void {
// doesn't work without a document (React Native)
const document = getGlobalObject<Window>().document;
if (!document) {
return;
}
if (!this._isEnabled()) {
logger.error('Trying to call showReportDialog with Sentry Client is disabled');
return;
}
const dsn = options.dsn || this.getDsn();
if (!options.eventId) {
logger.error('Missing `eventId` option in showReportDialog call');
return;
}
if (!dsn) {
logger.error('Missing `Dsn` option in showReportDialog call');
return;
}
const script = document.createElement('script');
script.async = true;
script.src = new API(dsn).getReportDialogEndpoint(options);
if (options.onLoad) {
script.onload = options.onLoad;
}
(document.head || document.body).appendChild(script);
}
示例2: constructor
/** Creates a new backend instance. */
public constructor(options: O) {
this._options = options;
if (!this._options.dsn) {
logger.warn('No DSN provided, backend will not do anything.');
}
this._transport = this._setupTransport();
}
示例3: setupIntegration
export function setupIntegration(integration: Integration): void {
if (installedIntegrations.indexOf(integration.name) !== -1) {
return;
}
integration.setupOnce(addGlobalEventProcessor, getCurrentHub);
installedIntegrations.push(integration.name);
logger.log(`Integration installed: ${integration.name}`);
}
示例4: defaultOnFatalError
export function defaultOnFatalError(error: Error): void {
console.error(error && error.stack ? error.stack : error);
const client = getCurrentHub().getClient<NodeClient>();
if (client === undefined) {
logger.warn('No NodeClient was defined, we are exiting the process now.');
global.process.exit(1);
return;
}
const options = client.getOptions();
const timeout =
(options && options.shutdownTimeout && options.shutdownTimeout > 0 && options.shutdownTimeout) ||
DEFAULT_SHUTDOWN_TIMEOUT;
forget(
client.close(timeout).then((result: boolean) => {
if (!result) {
logger.warn('We reached the timeout for emptying the request buffer, still exiting now!');
}
global.process.exit(1);
}),
);
}
示例5:
client.close(timeout).then((result: boolean) => {
if (!result) {
logger.warn('We reached the timeout for emptying the request buffer, still exiting now!');
}
global.process.exit(1);
}),
示例6:
this._transport.sendEvent(event).catch(reason => {
logger.error(`Error while sending event: ${reason}`);
});
示例7: getCurrentHub
export function initAndBind<F extends Client, O extends Options>(clientClass: ClientClass<F, O>, options: O): void {
if (options.debug === true) {
logger.enable();
}
getCurrentHub().bindClient(new clientClass(options));
}