-
Notifications
You must be signed in to change notification settings - Fork 0
CustomLogger
Danny edited this page Feb 24, 2022
·
2 revisions
You may use a different logger, for this project we did not include
a common logging library due to how big they are in most cases, but
if you need to use a different logging library, you can create a wrapper
that implements the ILogger
interface (exported by Turbo) and then map up
the functions, an example of the custom logger structure:
class CustomLogger implements ILogger {
public info(...args: any[]): void {
console.log('customlogger::info', ...args);
}
public warn(...args: any[]): void {
console.warn('customlogger::warn', ...args);
}
public error(...args: any[]): void {
console.error('customlogger::error', ...args);
}
public verbose(...args: any[]): void {
console.log('customlogger::verbose', ...args);
}
public debug(...args: any[]): void {
console.log('customlogger::debug', ...args);
}
}
To register the logger with the engine, you can do the following:
import { Engine } from '@symbux/turbo';
import { CustomLogger } from './CustomLogger';
const engine = new Engine({
// ...
logger: new CustomLogger(),
// ...
});
- Controllers
- Middleware
- Autowire
- Plugins
- Tasks
- Fibres
- Authentication
- Registry
- Services
- Dependecy Injection
- Translations (i18n)
- Safe Quit
- Exception Handling
- Event Listener
- Custom Logger
- HTTP Plugin - Built-In
- WS Plugin - Built-In
- Discord Plugin - External
- Vite Plugin - External
- Inspect Plugin - External
- CLI Plugin - External
- Got an issue? Join our Discord
- Need your own plugin? Contact Me
- Have an idea? Let's Discuss
- Want to support me? Buy me a coffee