Skip to content

Commit f4adaa9

Browse files
committed
fix(mobile): moved debug logging to desktop only
1 parent ddb0fb5 commit f4adaa9

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/util/logger.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import { Platform } from 'obsidian';
12
import { PluginInfo } from 'src/core/plugin-info';
23

34

45

56
export class Log {
67

78
/**
8-
* Logs only if `process.env.NODE_ENV !== 'production'`.
9+
* Logs only if `Platform.isDesktopApp` and if available `process.env.NODE_ENV !== 'production'`.
910
*
1011
* Adds useful information to the log message and then logs it using `console.log`.
1112
*
@@ -14,10 +15,16 @@ export class Log {
1415
*/
1516
static debug(message: string, ...args: any[])
1617
{
17-
if (process.env.NODE_ENV === 'production') return;
18+
if (Platform.isDesktopApp)
19+
{
20+
// in case it is unknown we assume production, even though it is not correct
21+
// it serves the purpose of not logging, when not in dev mode.
1822

19-
20-
console.log(`[DEBUG][${PluginInfo.pluginId}]: ${message}`, ...args);
23+
if ((process?.env?.NODE_ENV ?? 'production') !== 'production')
24+
{
25+
console.log(`[DEBUG][${PluginInfo.pluginId}]: ${message}`, ...args);
26+
}
27+
}
2128
}
2229

2330

0 commit comments

Comments
 (0)