[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Logging Facility for Octave
From: |
Andrew Janke |
Subject: |
Re: Logging Facility for Octave |
Date: |
Fri, 4 Jan 2019 14:46:19 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 |
On 1/4/19 2:22 PM, Pavel Hofman wrote:
Hi,
Please is there any logging facility for octave? The error/warning
functions have a deeper behavior, I am just looking for a configurable
facility issuing text strings to stderr/stdout/logfile with timestamp,
scriptname etc. - some simple form of log4j etc.
I can write my own octave methods but perhaps there is a
performance-optimised package or some best practice.
Thanks a log for any help.
Best regards,
Pavel.
For logging in Matlab, I actually use an M-code wrapper layer that sits
on top of log4j + SLF4J and presents an M-code interface for it (with
short-circuiting for performance) and a little configurator GUI. That
way you get all the features of log4j/SLF4J, and any Java code or
libraries you use in your application can go through the same logging
mechanism so it can be configured at a single point.
https://github.com/apjanke/SLF4M
(Background - I've used logging layers like this in enterprise Matlab
systems, so I'm confident it's a decent approach.)
It wouldn't be too hard to port this to Octave. Or if Java dot-reference
support were added to Octave (https://savannah.gnu.org/bugs/?48428), it
should just work as is.
There are a couple other logging packages on MathWorks File Exchange
that use pure M-code, and might work as is in Octave, too.
https://www.mathworks.com/matlabcentral/fileexchange/?utf8=%E2%9C%93&term=logging
I wouldn't worry about performance optimization too much; the main thing
to worry about is keeping your logging calls out of tight loops.
Cheers,
Andrew