mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* Add winston formatting support for error causes Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix failing to run built version - Finally make logger fully injectable - Simplify startMainApplication to only have runMany(Sync) invocations to fix time of use bugs related to logger Signed-off-by: Sebastian Malton <sebastian@malton.name> * Remove legacy type enforced ipc to fix tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix type error Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Sebastian Malton <sebastian@malton.name>
29 lines
974 B
TypeScript
29 lines
974 B
TypeScript
/**
|
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
*/
|
|
import { getInjectable } from "@ogre-tools/injectable";
|
|
import { transports } from "winston";
|
|
import directoryForLogsInjectable from "../../common/app-paths/directory-for-logs.injectable";
|
|
import { loggerTransportInjectionToken } from "../../common/logger/transports";
|
|
|
|
const fileLoggerTranportInjectable = getInjectable({
|
|
id: "file-logger-tranport",
|
|
instantiate: (di) => new transports.File({
|
|
handleExceptions: false,
|
|
level: "debug",
|
|
filename: "lens.log",
|
|
/**
|
|
* SAFTEY: the `ipcMain` check above should mean that this is only
|
|
* called in the main process
|
|
*/
|
|
dirname: di.inject(directoryForLogsInjectable),
|
|
maxsize: 1024 * 1024,
|
|
maxFiles: 16,
|
|
tailable: true,
|
|
}),
|
|
injectionToken: loggerTransportInjectionToken,
|
|
});
|
|
|
|
export default fileLoggerTranportInjectable;
|