-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathloggingActions.m
More file actions
33 lines (25 loc) · 881 Bytes
/
loggingActions.m
File metadata and controls
33 lines (25 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function [] = loggingActions(currdir,stepNumber, ActionString)
%This fucntion logs the the action ActionString in a ActionLog.txt file
% with time stamps of the action ActionString.
%
% (C) MP Branco, jan2017
%
global ALICE
fID = fopen([currdir 'log_info/Step' num2str(stepNumber) '_log.txt']);
if fID == -1
% create file if it doesn-t exist
fID = fopen([currdir 'log_info/Step' num2str(stepNumber) '_log.txt'], 'a');
% give it a title
fprintf(fID, '\nAction log of ALICE\n\n');
fprintf(fID, 'Version %f %s', ALICE.version, ALICE.date);
fprintf(fID, '---------------------------------------------------------\n\n');
else
fID = fopen([currdir 'log_info/Step' num2str(stepNumber) '_log.txt'], 'a');
end
% add time stamp
date = datestr(datetime('now'));
fprintf(fID,date);
% log the action here
fprintf(fID, [ActionString '\n']);
fclose(fID);
end