Skip to content

Commit 29b50ff

Browse files
authored
Merge pull request #46 from HeeManSu/fixing_logger_issue
2 parents d3d9d45 + 1fc1ea1 commit 29b50ff

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

package-lock.json

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

src/utils/autoDeploy.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
currentFile,
1010
protocol
1111
} from '../constants';
12-
import { isIAllApps } from './utils';
12+
import { isIAllApps, logProcessOutput } from './utils';
1313

1414
export const findJsonFilesRecursively = async (
1515
appsDir: string
@@ -36,12 +36,8 @@ export const findJsonFilesRecursively = async (
3636
currentFile
3737
});
3838

39-
proc.stdout?.on('data', (data: Buffer) => {
40-
console.log(data.toString().green);
41-
});
42-
proc.stderr?.on('data', (data: Buffer) => {
43-
console.log(data.toString().red);
44-
});
39+
logProcessOutput(proc.stdout, 'green');
40+
logProcessOutput(proc.stderr, 'red');
4541

4642
proc.on('message', (data: childProcessResponse) => {
4743
if (data.type === protocol.g) {

src/utils/logger.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ export const logger = {
1010
const timeStamp = new Date().toISOString();
1111
const logMessage = `${timeStamp} - ${message}\n`;
1212
console.log(message);
13-
if (!fs.existsSync(logFileFullPath)) {
14-
fs.writeFileSync(logFileFullPath, '', { encoding: 'utf-8' });
13+
14+
if (!fs.existsSync(logFilePath)) {
15+
fs.mkdirSync(logFilePath, { recursive: true });
1516
}
1617
fs.appendFileSync(logFileFullPath, logMessage, { encoding: 'utf-8' });
1718
}

0 commit comments

Comments
 (0)