To enhance debugging and observability, it's proposed to add optional default logging within the Rust modules of axum-js. This logging should cover key events such as server startup, routes registration, and any other significant lifecycle events. The logging should be designed to be toggled on or off via a JavaScript API to avoid unnecessary log verbosity in production environments.
A proposed API in JavaScript to enable logging might look like this:
import { AxumApp } from "./index";
const app = new AxumApp();
app.registerLogging({ emoji: true, timestamp: true });
In this example:
emoji: true would enable emoji icons in log messages for better readability and quicker identification of log levels or events.
timestamp: true would prepend timestamps to log messages to provide context on when events occurred.
Potential log messages include:
"🚀 Server started at port {port}"
"🔗 Route registered: {method} {path}"
...and others as deemed necessary.
Acceptance Criteria:
Implement a logging mechanism within the Rust modules that can be enabled or disabled through the JavaScript API.
Ensure the logging API in JavaScript is easy to use and well-documented.
Log key events such as server startup and route registration.
Ensure that log messages are clear, informative, and follow a consistent format.
Update documentation to explain how to enable/disable logging, what events are logged, and how to use the JavaScript API to control logging.
Create a PR with the implemented logging mechanism, updated documentation, and necessary tests (if applicable).
The implementation should adhere to the project’s STYLE_GUIDE.md.
To enhance debugging and observability, it's proposed to add optional default logging within the Rust modules of
axum-js
. This logging should cover key events such as server startup, routes registration, and any other significant lifecycle events. The logging should be designed to be toggled on or off via a JavaScript API to avoid unnecessary log verbosity in production environments.A proposed API in JavaScript to enable logging might look like this:
In this example:
emoji: true
would enable emoji icons in log messages for better readability and quicker identification of log levels or events.timestamp: true
would prepend timestamps to log messages to provide context on when events occurred.Potential log messages include:
Acceptance Criteria:
STYLE_GUIDE.md
.