Commit df6432c 1 parent c1f05bc commit df6432c Copy full SHA for df6432c
File tree 1 file changed +20
-1
lines changed
extension-manifest-v3/src/background/reporting
1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
18
18
UrlReporter ,
19
19
RequestReporter ,
20
20
setLogLevel ,
21
+ describeLoggers ,
21
22
} from '@whotracksme/webextension-packages/packages/reporting' ;
22
23
import { getBrowserInfo } from '@ghostery/libs' ;
23
24
@@ -33,7 +34,21 @@ const webRequestPipeline = new WebRequestPipeline();
33
34
// Important to call it in a first tick as it assigns chrome. listeners
34
35
webRequestPipeline . init ( ) ;
35
36
36
- setLogLevel ( 'debug' ) ;
37
+ ( async ( ) => {
38
+ try {
39
+ const key = 'ghosteryReportingLoggerConfig' ;
40
+ const { [ key ] : config } = ( await chrome . storage . local . get ( key ) ) || { } ;
41
+ if ( config ) {
42
+ for ( const { level, prefix = '*' } of config ) {
43
+ setLogLevel ( level , prefix ) ;
44
+ }
45
+ } else {
46
+ setLogLevel ( 'off' ) ;
47
+ }
48
+ } catch ( e ) {
49
+ console . warn ( 'Failed to apply logger overwrites' , e ) ;
50
+ }
51
+ } ) ( ) ;
37
52
38
53
function platformSpecificSettings ( ) {
39
54
if (
@@ -261,4 +276,8 @@ globalThis.ghostery.WTM = {
261
276
config,
262
277
webRequestPipeline,
263
278
extensionStartedAt : new Date ( ) ,
279
+ logging : {
280
+ setLogLevel,
281
+ describeLoggers,
282
+ } ,
264
283
} ;
You can’t perform that action at this time.
0 commit comments