feat: use @affine/debug (#1244)

This commit is contained in:
Himself65
2023-03-01 20:13:45 -06:00
committed by GitHub
parent 1abab690af
commit a099ed5f29
15 changed files with 40 additions and 252 deletions
+4 -6
View File
@@ -2,13 +2,11 @@
"name": "@affine/debug",
"private": true,
"main": "./src/index.ts",
"keywords": [],
"repository": {
"type": "git",
"url": "git+https://github.com/toeverything/AFFiNE.git"
},
"dependencies": {
"@types/debug": "^4.1.7",
"@affine/env": "workspace:*",
"debug": "^4.3.4"
},
"devDependencies": {
"@types/debug": "^4.1.7"
}
}
+6 -4
View File
@@ -1,11 +1,13 @@
import { getEnvironment } from '@affine/env';
import debug from 'debug';
type LogLevel = 'debug' | 'info' | 'warn' | 'error';
const SESSION_KEY = 'affine:debug';
const development = process.env.NODE_ENV === 'development';
const env = getEnvironment();
if (typeof window !== 'undefined') {
const SESSION_KEY = 'affine:debug';
const development = env.isDebug;
if (env.isBrowser) {
// enable debug logs if the URL search string contains `debug`
// e.g. http://localhost:3000/?debug
if (window.location.search.includes('debug')) {
+10
View File
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"target": "ESNext",
"sourceMap": true
},
"include": ["./src"],
"exclude": ["node_modules"]
}