-
Notifications
You must be signed in to change notification settings - Fork 19
/
mgstat_verbose.m
50 lines (42 loc) · 1.04 KB
/
mgstat_verbose.m
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
% mgstat_verbose : list verbose information to the console
%
% Call:
% mgstat_verbose(txt,verbose)
%
% txt [string] : text to be displayed
% verbose [integer] (def=0) : increase to see more information
%
% 'vlevel' must be set in the mgstat_verbose.m m-file.
%
% To set the verbose level dynamically, use e.g.
% setenv('MGSTAT_VERBOSE_LEVEL','10')
%
%
% All entries with vebose>vlevel are displayed
%
%
% entries with a higher verbose value has a higher chance of being displayed
% that entries with lower verbose values
% verbose [0] : warnings (default)
% [1] : function names
% [2] : subfunction progress
%
%
%
function mgstat_verbose(txt,verbose)
vlevel=0; % SHOW ALL VERBOSE INFO WITH 'VERBOSE' ABOVE 'VLEVEL'
try
% GET VERBOSE LEVEL FROM SYSTEM VARIABLE IF SET
tmp=str2num(getenv('MGSTAT_VERBOSE_LEVEL'));
if ~isempty(tmp)
vlevel=tmp;
end
end
if nargin==1,
verbose=0;
end
if (verbose<=vlevel),
%if (verbose>=vlevel),
txt1=mfilename;
disp(sprintf('%s',txt));
end