Skip to content

Commit a4d95bc

Browse files
committed
feat: browser no longer enables by default
__*BREAKING CHANGE*__ In the past we enbaled anyting in the `DEBUG` localStorage key, this lead to some undesired behaviours when working with sandboxed iframes. Now we will let the you control this completely, as from what I can see the majority of folk I see, use it anyway. Still makes sense to run this for Node applications, which is left un touched. If you want the existing behaviour, just attached this before you start logging. ```ts import { enable } from 'diary'; enable(localStorage.DEBUG || 'a^'); ``` fixes: #15
1 parent 1319eaf commit a4d95bc

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/index.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,7 @@ export const enable = (allows_query: string) => {
88
};
99

1010
// read `localstorage`/`env` for scope "name"s allowed to log
11-
if (__TARGET__ !== 'worker') {
12-
enable(
13-
(__TARGET__ === 'node'
14-
? process.env.DEBUG
15-
: __TARGET__ === 'browser'
16-
? localStorage.getItem('DEBUG')
17-
: null
18-
) || 'a^',
19-
);
20-
}
11+
if (__TARGET__ === 'node') enable(process.env.DEBUG || 'a^');
2112

2213
// ~ Logger
2314

0 commit comments

Comments
 (0)