Adding new logging function

This commit is contained in:
2024-03-22 19:01:18 -05:00
parent 6dddc5799f
commit cac674e27a
6 changed files with 69 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ import cors from "cors";
import dotenv from "dotenv";
import dataRoutes from "./routes/dataRoutes.js";
import inventoryRoutes from "./routes/inventoryRoutes.js";
import { LoggingLevel, setLevel, smartLogging } from "./utils/helper.js";
dotenv.config();
@@ -16,5 +17,7 @@ app.use(express.json());
app.use("/api/data", dataRoutes);
app.use("/api/inventory", inventoryRoutes);
//Set Logging Level
setLevel(LoggingLevel.AppTrace); //This should get passed in from the Docker-Compose.
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => console.log(`Server running on port ${PORT}`));
app.listen(PORT, () => smartLogging(LoggingLevel.Logging, `Server running on port ${PORT}`));