Logger

A container utility class to log values of various variables and messages from MATLAB code.
496 Downloads
Updated 3 Oct 2011

View License

A MATLAB class to create objects that can be used to log various events during the execution of a MALTAB script/function. This class is mainly a container, with some additional functionality built in to operate on the stored data in generating plots, applying functions etc.

The main aim of this class is to consolidate and store all the outputs and messages from a MATLAB script/function into a single object. These objects can be saved, and retrieved later, with all the information in one place Several utility functions (mainly for plotting) make it easy to operate on the stored data.

There are several ways in which you can use this class. You can either
(1) create a logger object, and start logging into the object
(2) user's class can be inherited from logger
(3) a global/persistent logger object can be created to log from various functions
(4) you can use matlab's event framework to log events by adding appropriate listeners.

Simple Example usage:

l = logger;

for i = 1:100,
my_output_1 = 10*rand;
height = 1.5*my_output_1 + 5*rand;

l.logVal('weight', my_output_1);
l.logIt(height);
end

l.setDesc('weight','Weight of Subjects');
l.setDesc('height','Height of Subjects');
l.setDefaultDesc('Subject ID');

figure; l.plot2Vars('weight','height','LineWidth', 2, 'Color','r');
figure; l.plotVar('weight','LineWidth', 2, 'Color','r');
figure; l.plotVar('height','LineWidth', 2, 'Color','r');
figure; l.plotFofVar('height',@log, 'LineWidth', 2, 'Color','r');

Also see logger_demo.m for example usage.
Documentation in HTML format is included. It is automatically generated using Doxygen for MALTAB.

Cite As

Pavan Mallapragada (2024). Logger (https://www.mathworks.com/matlabcentral/fileexchange/33099-logger), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Software Development Tools in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!

logger-1.0/

Version Published Release Notes
1.1.0.0

Removed many documentation files that are useless, and retained only the class description.

1.0.0.0