Normalize to double quotes across all files with Prettier
This commit is contained in:
1 parent
73bff72cec
commit
a5659cf4c8
190 files changed
+9523
-8859
No files matched your search
@@ -1,14 +1,14 @@
|
||||
// logService.js
|
||||
const fs = require('fs');
|
||||
const util = require('util');
|
||||
const moment = require('../utils/moment');
|
||||
const fs = require("fs");
|
||||
const util = require("util");
|
||||
const moment = require("../utils/moment");
|
||||
|
||||
// Convert fs.writeFile to a promise-based function
|
||||
const writeFile = util.promisify(fs.writeFile);
|
||||
|
||||
// Ensure the log file exists and is accessible
|
||||
const logFilePath = 'showy.log';
|
||||
fs.open(logFilePath, 'a', (err, fd) => {
|
||||
const logFilePath = "showy.log";
|
||||
fs.open(logFilePath, "a", (err, fd) => {
|
||||
if (err) {
|
||||
console.error("Failed to open log file:", err);
|
||||
} else {
|
||||
@@ -21,10 +21,10 @@ fs.open(logFilePath, 'a', (err, fd) => {
|
||||
// Asynchronous function to append a message to the log file
|
||||
async function logToFile(message) {
|
||||
try {
|
||||
const time = moment().format('YYYY-MM-DD HH:mm:ss')
|
||||
const time = moment().format("YYYY-MM-DD HH:mm:ss");
|
||||
const formatedMsg = `[${time}] ${message}`;
|
||||
console.log(formatedMsg);
|
||||
await writeFile(logFilePath, formatedMsg + '\n', { flag: 'a' });
|
||||
await writeFile(logFilePath, formatedMsg + "\n", { flag: "a" });
|
||||
} catch (err) {
|
||||
console.error("Failed to write to log file:", err);
|
||||
}
|
||||
@@ -32,4 +32,4 @@ async function logToFile(message) {
|
||||
|
||||
module.exports = {
|
||||
logToFile,
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user