Getting Started with DoubleTie Logger
Learn how to set up and use the DoubleTie Logger in your Node.js or TypeScript project.
Getting Started Tutorial
In this tutorial, you'll set up the DoubleTie Logger and use its basic functionality. By the end, you'll understand how to create loggers, use different log levels, and format your messages.
Step 1: Create a basic logger
Create a new file in your project called logger.ts
:
Step 2: Use your logger
Now you can use the logger in any file:
Step 3: Configure log levels
By default, the logger only shows error messages. Let's modify it to show all messages in development and only warnings and errors in production:
You should now see all log messages in development but only warnings and errors in production.
Step 4: Using the default logger
If you prefer not to create your own logger instance, you can use the default one:
The default logger is configured to only show error messages, so you'll need to reconfigure it if you want to see other log levels:
Next Steps
Now that you have a basic logger set up, you can explore more advanced features: