diff --git a/utils/@Logger/Logger.m b/utils/@Logger/Logger.m index 4f64049..27c15cc 100644 --- a/utils/@Logger/Logger.m +++ b/utils/@Logger/Logger.m @@ -1,59 +1,74 @@ classdef Logger % Static interface to LogWriter properties (Constant, Access = private) writing = LogHandler; end methods (Static) function output = isactive() output = Logger.writing.active; end function start(logFileCategory) Logger.writing.start(logFileCategory); end function stop() Logger.writing.stop(); end function log(textToLog, varargin) if Logger.isactive Logger.writing.handle.log(textToLog, varargin{:}); end end function logn(textToLog, varargin) if Logger.isactive Logger.writing.handle.logn(textToLog, varargin{:}); end end function newSection(title) if Logger.isactive Logger.writing.handle.newSection(title); end end function newDelimitedSection(title) if Logger.isactive Logger.writing.handle.newDelimitedSection(title); end end function closeSection() if Logger.isactive Logger.writing.handle.closeSection(); end end function closeBlock() if Logger.isactive Logger.writing.handle.closeBlock(); end end + function output = timeLogExecution(executionDescription,... + functionHandle, functionArguments) + output = true; + try + Logger.log(executionDescription) + Timer.start(); + functionHandle(functionArguments); + Logger.logn("OK %s", Timer.stop()) + catch ME + Timer.stop(); + Logger.logn(ME.message) + output = false; + end + end + end end