How to write a Logger in MATLAB to record errors, warnings and success messages of a function file?

I have tried using Diary, but it does not store line number. Nor does it store the command after which the error is captured. I need to understand how to write a logger properly in MATLAB, so I could add messages as well along with capturing error.

4 comentarios

How are you hoping to use the information from the logger that you want to write? What's your end goal?
Atin
Atin el 13 de Mzo. de 2023
Editada: Atin el 13 de Mzo. de 2023
Hi Steven, The end goal is to have a log for every execution of the application with timestamp, input Parameter info, error & success Messages with line no. To have a simple log file. Something like Log4j but for Matlab.
I have also written functions to make this easier, but which are not present on the file exchange yet. I'm currently on mobile so I can't attach them. You can find an old version in this thread.

Iniciar sesión para comentar.

Respuestas (1)

As per my understanding you wanted a logger that helps you to record errors ,warnings and success messages of a function file.
You can use log4m for logging your matlab code . Log4m is designed to be relatively fast and very easy to use. It has been designed to work well in a matlab environment. Use this documentation to learn more about log4m -

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Productos

Versión

R2022b

Etiquetas

Preguntada:

el 13 de Mzo. de 2023

Respondida:

el 27 de Mzo. de 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by