Skip to content

Commit 2784e9b

Browse files
committed
init
1 parent ce82963 commit 2784e9b

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ Initialization settings:
7373
| `vue` | Vue constructor | optional | Pass Vue constructor to set up the [Vue integration](#integrate-to-vue-application) |
7474
| `disableGlobalErrorsHandling` | boolean | optional | Do not initialize global errors handling |
7575
| `disableVueErrorHandler` | boolean | optional | Do not initialize Vue errors handling |
76+
| `disableConsoleLogHandler` | boolean | optional | Do not initialize console logs tracking |
7677
| `beforeSend` | function(event) => event | optional | This Method allows you to filter any data you don't want sending to Hawk |
7778

7879
Other available [initial settings](types/hawk-initial-settings.d.ts) are described at the type definition.

src/catcher.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ export default class Catcher {
9292
*/
9393
private readonly disableVueErrorHandler: boolean = false;
9494

95+
/**
96+
* Disable console log handler
97+
*/
98+
private readonly disableConsoleLogHandler: boolean = false;
99+
95100
/**
96101
* Catcher constructor
97102
*
@@ -111,6 +116,7 @@ export default class Catcher {
111116
this.context = settings.context || undefined;
112117
this.beforeSend = settings.beforeSend;
113118
this.disableVueErrorHandler = settings.disableVueErrorHandler ?? false;
119+
this.disableConsoleLogHandler = settings.disableConsoleLogHandler ?? false;
114120

115121
if (!this.token) {
116122
log(
@@ -136,7 +142,10 @@ export default class Catcher {
136142
},
137143
});
138144

139-
initConsoleCatcher();
145+
if (!settings.disableConsoleLogHandler) {
146+
initConsoleCatcher();
147+
console.log('Console log handler initialized');
148+
}
140149

141150
/**
142151
* Set global handlers

src/types/hawk-initial-settings.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,9 @@ export interface HawkInitialSettings {
7373
* Used by @hawk.so/nuxt since Nuxt has own error hook.
7474
*/
7575
disableVueErrorHandler?: boolean;
76+
77+
/**
78+
* Disable console log handler
79+
*/
80+
disableConsoleLogHandler?: boolean;
7681
}

0 commit comments

Comments
 (0)