Skip to content

Commit ab2ac16

Browse files
committed
feat: add create logger function
1 parent 76b6b44 commit ab2ac16

File tree

3 files changed

+37
-7
lines changed

3 files changed

+37
-7
lines changed

electron/common/README.md

-6
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,3 @@ This folder contains code shared between the `main` and `renderer` processes.
66

77
Common code cannot use any Node APIs like `fs`, `path`, or `process` because
88
node integration is not enabled in the `renderer` process per security best practices.
9-
10-
# Bundling
11-
12-
This folder does not contain its own `tsconfig.json` because it is not compiled independently.
13-
It is bundled with the `main` and `renderer` processes separately and tree shaking removes
14-
from each's bundle the code that is not used.

electron/common/logger/logger.utils.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import electronLog, { LogMessage } from 'electron-log';
22
import { camelCase, get } from 'lodash';
3-
import { LogData, LogFunction } from './logger.types';
3+
import { LogData, LogFunction, Logger } from './logger.types';
4+
5+
export function createLogger(scope?: string): Logger {
6+
return scope ? electronLog.scope(scope) : electronLog;
7+
}
48

59
export function initializeLogging(logger: electronLog.Logger): void {
610
// Add our custom log formatter.

electron/common/tsconfig.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ESNext",
4+
"module": "CommonJS",
5+
"moduleResolution": "Node",
6+
"incremental": true,
7+
"baseUrl": ".",
8+
"outDir": "../build/common",
9+
"declaration": false,
10+
"sourceMap": true,
11+
"inlineSources": true,
12+
// Set `sourceRoot` to "/" to strip the build path prefix
13+
// from generated source code references.
14+
// This improves issue grouping in Sentry.
15+
"sourceRoot": "/",
16+
"allowJs": true,
17+
"strict": true,
18+
"alwaysStrict": true,
19+
"esModuleInterop": true,
20+
"resolveJsonModule": true,
21+
"forceConsistentCasingInFileNames": true,
22+
"allowSyntheticDefaultImports": true,
23+
"emitDecoratorMetadata": true,
24+
"experimentalDecorators": true,
25+
"skipLibCheck": true,
26+
"isolatedModules": true,
27+
"jsx": "preserve",
28+
"lib": ["DOM", "DOM.Iterable", "ESNext"]
29+
},
30+
"exclude": ["node_modules"],
31+
"include": ["**/*.ts"]
32+
}

0 commit comments

Comments
 (0)