web3.db-fileconnector
Version:
GraphQL System Built on web3 technologies. Web3.DB is an open database built on top of web3 technologies. It is a decentralized, open-source database that allows users to store and query data in a secure and efficient manner. The system is designed to be
40 lines (34 loc) • 1.12 kB
JavaScript
const fs = require("fs");
const { exec } = require("child_process");
// Create a log file in ./log/ceramic
const logFilePath = "./server/logs/ceramic.log";
if (!fs.existsSync(logFilePath)) {
fs.writeFileSync(logFilePath, "");
}
// Define the log function to write messages to the log file
function log(message) {
const timestamp = new Date().toISOString();
const formattedMessage = `${timestamp} - ${message}\n`;
fs.appendFileSync(logFilePath, formattedMessage);
console.log(formattedMessage);
}
// Define the system check function
async function systemCheck() {
try {
// Execute the necessary commands and write the output to the log file
await exec("node ./server/system-check.js", (error, stdout, stderr) => {
if (error) {
log(`Error: ${error.message}`);
} else {
log(stdout);
}
});
// Log that the system check completed successfully
log("System check completed successfully");
} catch (error) {
log(`Error: ${error.message}`);
process.exit(1);
}
}
// Run the system check function
systemCheck();