Advanced Logger Extension

Hi all,

I’m happy to introduce the Advanced Logger Extension for Wappler, a powerful and flexible logging solution for your Wappler projects. This extension enhances the existing logging functionality by integrating the Pino library, Logtail for log aggregation, and Sentry for error tracking.

Key Features:

  • Customizable log levels
  • Async logging
  • Pretty printing for console output
  • Integration with Logtail and Sentry
  • Log redaction support for sensitive data
  • Log file management (automatic creation and removal)
  • Flexible transport configuration (console, file, Logtail, and Sentry)
  • Multiple concurrent types of transport

To help you understand and make the most of this extension, I’ve created a YouTube video that explains its features and benefits. It’s my first YouTube video, so these will hopefully improve over time.

You can find the GitHub repo containing the extension and comprehensive documentation here:

Feel free to give it a try and share your feedback! I hope you find the Advanced Logger Extension a valuable addition to your Wappler projects.

15 Likes

Thank you, Tobias, for an amazing job! This extension is definitely gonna help many Wappler users. And tutorial video came out great too. :+1:

1 Like

Somehow missed this. This is absolutely amazing! Thank you so much Tobias.
Will need to make some time to set this up, when I do I’ll make sure to give feedback :slight_smile:

1 Like

This is fantastic @tbvgl!

1 Like

Thanks @nickneustroev, @karh and @kfawcett!

I’m happy to hear that this is helpful to you.

Btw I didn’t update the docs, yet but you can simply install the extension with npm i wappler-advanced-logger instead of cloning the files from GitHub. This will move everything to the right directories and auto-update the extension for you.

1 Like

It looks like we are getting quite a few downloads :smiley:

Videos about the bull extension will follow soon, and the new major version will be released today.

Thanks to all!

7 Likes

Congrats on both releases: bull queues v2 and this one!

I checked the code for the logger and I detected an improvement that eventually could be added.
Adding it here as a note not as a request.

I think transports integrations could be refactored and extracted into their own modules. So anyone can plug their own to cover their needs.

2 Likes

@JonL Thanks!

Yeah, that would be possible. But people can also just let me know what transports they would like me to add, and I add them to make sure it is 100% compatible with the extension.

I have a local version that has opensearch integrated, and I’m open to adding more.

Pull requests are welcome as well. Anyways making it modular, as you suggested, would be an option as well. :slight_smile:

1 Like

Congratulations. As you know I am new on this. I dont know where I will use it but the tutorial came very clear…

1 Like

Please update your extension if you use redaction keys and the HTTP logger enabled by default.

pino-http has a bug that redacts the logs of HTTP requests AND removes the actual objects from the requests. This can lead to authentication requests etc., failing. I just pushed a fix for that.

Hey Tobias,

I’m using Advanced Logger with Sentry which is working properly logging, except that LOG_ENVIRONMENT does not flow through to Sentry. Everything’s coming up in Sentry as production, despite me setting to development.

Is this the expected behavior?

Hey Ken,

no that’s not expected behavior.
But I already built a better middleware for Sentry and didn’t update the advanced logger with that one, yet. I might release it as a standalone extension and remove Sentry from the logging extension since the new middleware tracks full stack trace etc and is way better overall.

Feel free to send me a dm and I can send it to you for testing tmr.

Hi @tbvgl,

Thanks for releasing this cool extension.

I noticed a slight issue with saving the logs to folder.

On line 11-13 in advanced-logger.js you have

 const logFilePath = process.env.LOG_FILE_PATH
   ? `${process.env.LOG_FILE_PATH}${getCurrentDate()}.log`
   : null;

However, this does not save the logs in the directory. There is a / missing. I have changed it to:

const logFilePath = process.env.LOG_FILE_PATH
  ? `${process.env.LOG_FILE_PATH}/${getCurrentDate()}.log`
  : null;

And now it works.

Also: for Windows users that are looking to inspect these log files. I have tried https://github.com/zarunbal/LogExpert
and it works pretty well. you need to use columnizer>Jsoncolumnizer.JsonColumnizer in order the get the logs in a nice table format.

To make it more readable I changed the date formatting to something more human readable by adding one line to const logger in advanced-logger.js:

const logger = pino(
  {
    level: logLevel,
    redact: redactionKeys,
    allowErrorLevels: true,
    timestamp: () => `,"time":"${new Date().toLocaleString()}"`,
  },
  transport
);
1 Like

Thanks @jellederijke!
I will include the fix for the file path with the next update :slight_smile:

1 Like

This is great work and extremely useful @tbvgl. Thank you.

1 Like