Include Dynare version and input arguments into log file

The log file is now started from dynare.m.

Closes: #1743
time-shift
Sébastien Villemot 2021-01-06 14:29:37 +01:00
parent 90e493c34c
commit 25d5352350
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
2 changed files with 21 additions and 11 deletions

View File

@ -16,7 +16,7 @@ function dynare(fname, varargin)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2001-2020 Dynare Team
% Copyright (C) 2001-2021 Dynare Team
%
% This file is part of Dynare.
%
@ -184,6 +184,16 @@ nolog = ismember('nolog', varargin) || ismember('nolog', file_opts);
onlymacro = ismember('onlymacro', varargin) || ismember('onlymacro', file_opts);
onlyjson = ismember('onlyjson', varargin) || ismember('onlyjson', file_opts);
% Start journal
diary off
if ~nolog
logfile = [ fname(1:end-4) '.log' ];
if exist(logfile, 'file')
delete(logfile)
end
diary(logfile)
end
if ispc
arch = getenv('PROCESSOR_ARCHITECTURE');
else
@ -265,15 +275,8 @@ if exist(fname(1:end-4),'dir') && exist([fname(1:end-4) filesep 'hooks'],'dir')
run([fname(1:end-4) filesep 'hooks/postprocessing'])
end
% Save preprocessor result in logfile (if `no_log' option not present)
if ~nolog
logname = [fname(1:end-4) '.log'];
fid = fopen(logname, 'w');
fprintf(fid, '%s', result);
fclose(fid);
end
if status
diary off
% Should not use "error(result)" since message will be truncated if too long
error('Dynare: preprocessing failed')
end
@ -286,7 +289,14 @@ end
% within the driver will clean the rest)
clear(['+' fname '/driver'])
evalin('base',[fname '.driver']) ;
try
evalin('base',[fname '.driver']) ;
catch ME
diary off
rethrow(ME)
end
diary off
end

@ -1 +1 @@
Subproject commit 7f77c4df60d198db69b0e200a02802cae2454910
Subproject commit 78874a01d3040f7841bda72e0efd8b30dbe4f974