mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
72ea58267d
Adds a new app menu for creating a new workspace or switching to an existing one. This required adding a new WPS event any time a workspace gets updated, since the Electron app menus are static. This also fixes a bug where closing a workspace could delete it if it didn't have both a pinned and an unpinned tab.
32 lines
883 B
TypeScript
32 lines
883 B
TypeScript
import path from "path";
|
|
import { format } from "util";
|
|
import winston from "winston";
|
|
import { getWaveDataDir, isDev } from "./platform";
|
|
|
|
const oldConsoleLog = console.log;
|
|
|
|
const loggerTransports: winston.transport[] = [
|
|
new winston.transports.File({ filename: path.join(getWaveDataDir(), "waveapp.log"), level: "info" }),
|
|
];
|
|
if (isDev) {
|
|
loggerTransports.push(new winston.transports.Console());
|
|
}
|
|
const loggerConfig = {
|
|
level: "info",
|
|
format: winston.format.combine(
|
|
winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss.SSS" }),
|
|
winston.format.printf((info) => `${info.timestamp} ${info.message}`)
|
|
),
|
|
transports: loggerTransports,
|
|
};
|
|
const logger = winston.createLogger(loggerConfig);
|
|
function log(...msg: any[]) {
|
|
try {
|
|
logger.info(format(...msg));
|
|
} catch (e) {
|
|
oldConsoleLog(...msg);
|
|
}
|
|
}
|
|
|
|
export { log };
|