Commit c1c360e3 authored by Brad Kennedy's avatar Brad Kennedy
Browse files

* VERSION: 1.0.5

        * batch/exec_func/ef_current_base.m: Fixed reference to logging_log

        * batch/exec_func/rsub_sys.m: Fixed reference to logging_log
parent b24c39d0
2017-08-14 Brad Kennedy <bk@co60.ca>
* VERSION: 1.0.5
* batch/exec_func/ef_current_base.m: Fixed reference to logging_log
* batch/exec_func/rsub_sys.m: Fixed reference to logging_log
2017-08-09 Mike Cichonski <mike.cichonski@gmail.com>
* VERSION: 1.0.4
......
......@@ -67,7 +67,7 @@ for i=1:length(d)
diary('off');
catch err
logging_log('ERROR', sprintf('Script %s, in %s, failed', ...
disp(sprintf('Script %s, in %s, failed', ...
evalfname, job_struct(end).m_path))
msg_fstack = logging_fcallstack([], [], [], err);
......@@ -81,3 +81,45 @@ end
rmpath(fullfile(cd, job_struct(end).context_config.log, ...
job_struct(end).m_path));
end
%% From matlog
function output = logging_fcallstack(messagen, formatstr, unroll, lerror)
global CALL_STACK_FORMAT;
if ~exist('formatstr', 'var') || (exist('formatstr', 'var') ...
&& isempty(formatstr))
formatstr = '\tat %s(%s:%d)\n';
end
if ~isempty(CALL_STACK_FORMAT)
formatstr = CALL_STACK_FORMAT;
end
if ~exist('messagen', 'var') || isempty(messagen)
messagen = 'Stack trace:\n';
end
if ~exist('unroll', 'var') || isempty(unroll)
unroll = 1;
end
output = '';
if ~exist('lerror', 'var')
stack = dbstack();
else
stack = lerror.stack;
output = sprintf('ERROR: %s\n', lerror.message);
unroll = unroll - 1;
end
output = [output sprintf(messagen)];
% CHECK: should this be < or <=
if numel(stack) < unroll+1
return;
end
stack = stack(unroll+1:end);
for i = 1:numel(stack)
level = stack(i);
output = [output sprintf(formatstr, level.file, level.name, ...
level.line)];
end
end
......@@ -115,9 +115,7 @@ end
function result_str = system_cmd_or_error(cmd, msg)
[exit_status, result_str] = system(cmd, '-echo');
if exit_status ~= 0
logging_log('ERROR', msg);
logging_log('INFO', sprintf('\tCommand was: %s', cmd));
error('System error: %s', msg);
error('System error: %s\n\tCommand was: %s', msg, cmd);
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment