Skip to content

Commit da638a9

Browse files
committed
feat: Extended the advanced example
1 parent cc10cc3 commit da638a9

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

examples/advanced-example.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const logger = new ACL({
55
includeTimestamps: true, // Include timestamps in all log messages.
66
includeMemoryUsage: true, // Track and display memory usage information in the logs.
77
memoryDisplayMode: 2, // Memory display mode: (1 = MB, 2 = %, 3 = both MB and %).
8-
generateReport: true, // Generate a report at the end of the logging session showing log method usage statistics.
98

109
// Caller Information Settings
1110
includeCallerInfo: 1, // Enable the inclusion of caller information (file, line, and column) in log messages.
@@ -16,15 +15,23 @@ const logger = new ACL({
1615

1716
// Inline Caller Information Settings
1817
includeInlineCallerInfo: 1, // Display inline caller information within the log message (quick debugging reference).
19-
inlineCallerInfoLevel: 3, // Minimum log level to include inline caller information (similar to `callerInfoLevel`).
18+
inlineCallerInfoLevel: 3, // Inline caller information level that controls the inline display of caller information.
2019

2120
terminateOnFatal: true, // Terminate the application on a `fatal` log message.
2221
});
2322

24-
// Logging with different levels to demonstrate color differences
25-
logger.debug("This is a debug message.");
26-
logger.log("This is a regular log message.");
27-
logger.info("This is an informational message.");
28-
logger.warn("This is a warning message, it will include caller information.");
29-
logger.error("This is an error message, it will include caller information.");
30-
logger.fatal("This is a fatal message, terminating the process.");
23+
function subFunction() {
24+
logger.log(true, "This is a regular log message.");
25+
}
26+
27+
async function main() {
28+
// Logging with different levels to demonstrate color differences
29+
logger.debug("This is a debug message.");
30+
logger.log("This is a regular log message.");
31+
subFunction();
32+
logger.info("This is an informational message.");
33+
logger.warn("This is a warning message, it will include caller information.");
34+
logger.error("This is an error message, it will include caller information.");
35+
logger.fatal("This is a fatal message, terminating the process.");
36+
}
37+
main();

0 commit comments

Comments
 (0)