Skip to content

Commit b2977e8

Browse files
committed
cmd remove log tweak again
1 parent 0122f4a commit b2977e8

File tree

4 files changed

+132
-1
lines changed

4 files changed

+132
-1
lines changed

lib/debug.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const msgColors = {
3737
ERROR: chalk.red,
3838
};
3939

40+
4041
function applyCustomPlugin(logger, options = {}) {
4142
const originalFactory = logger.methodFactory;
4243
logger.methodFactory = (methodName, logLevel, loggerName) => {
@@ -65,6 +66,7 @@ function applyCustomPlugin(logger, options = {}) {
6566
}
6667

6768
function setupLogger() {
69+
fs.mkdirsSync(getLogRootDir());
6870
applyCustomPlugin(log, { inspectObject: true, coloredMessage: true });
6971
prefix.reg(log);
7072
prefix.apply(log, {
@@ -85,9 +87,11 @@ function setupLogger() {
8587
});
8688
}
8789

90+
function getLogRootDir() { return path.join(os.tmpdir(), "mediac"); }
91+
8892
export const fileLogName = (logFileName = "mediac") => {
8993
const name = `${logFileName}_log_${nowDateStr}.txt`;
90-
return path.resolve(path.join(os.tmpdir(), name));
94+
return path.resolve(path.join(getLogRootDir(), name));
9195
}
9296

9397
export const fileLog = (logText, logTag = "", logFileName = "mediac") => {

package-lock.json

+125
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"loglevel-plugin-prefix": "^0.8.4",
5656
"music-metadata": "^7.14.0",
5757
"node-taglib-sharp-extend": "^0.2.9",
58+
"open": "^10.1.0",
5859
"p-filter": "^4.1.0",
5960
"p-map": "^7.0.1",
6061
"p-queue": "^8.0.0",

scripts/media_cli.js

+1
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ async function main() {
160160
if (await fs.pathExists(log.fileLogName())) {
161161
const filePath = log.fileLogName().split(path.sep).join("/");
162162
log.showYellow(`See logs: file:///${filePath}`);
163+
// await open(filePath)
163164
}
164165
}
165166
}

0 commit comments

Comments
 (0)