Compare commits
No commits in common. "v4" and "main" have entirely different histories.
31
index.js
31
index.js
@ -1,31 +0,0 @@
|
|||||||
const winston = require('winston');
|
|
||||||
|
|
||||||
// Configure logging using winston
|
|
||||||
const logger = winston.createLogger({
|
|
||||||
level: 'info',
|
|
||||||
format: winston.format.combine(
|
|
||||||
winston.format.timestamp(),
|
|
||||||
winston.format.printf(({ timestamp, level, message }) => `${timestamp} - ${level.toUpperCase()}: ${message}`)
|
|
||||||
),
|
|
||||||
transports: [
|
|
||||||
new winston.transports.Console(),
|
|
||||||
new winston.transports.File({ filename: 'app.log' })
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// Main function to add two numbers and log the result
|
|
||||||
function addNumbers(a, b) {
|
|
||||||
logger.info(`Function called with inputs: a=${a}, b=${b}`);
|
|
||||||
|
|
||||||
const result = a + b;
|
|
||||||
|
|
||||||
logger.info(`The result of adding ${a} and ${b} is: ${result}`);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Example usage
|
|
||||||
const num1 = 5;
|
|
||||||
const num2 = 8;
|
|
||||||
const sum = addNumbers(num1, num2);
|
|
||||||
|
|
||||||
console.log(`Sum: ${sum}`);
|
|
||||||
Loading…
Reference in New Issue
Block a user