Home > vbmeg > functions > common > utility > vb_get_verbose.m

vb_get_verbose

PURPOSE ^

Get verbose level from VBMEG environment (global) variable 'vbmeg_inst'.

SYNOPSIS ^

function [verbose_level,verbose_str] = vb_get_verbose

DESCRIPTION ^

 Get verbose level from VBMEG environment (global) variable 'vbmeg_inst'.

 [syntax]
 [verbose_level,verbose_str] = vb_get_verbose

 [input]

 [output]
 verbose_level: <<int>> Verbose level value. Larger value supresses
                more messages. 
 verbose_str  : <<string>> Verbose level string. 
  'NONE'      Suppressing all messages 
  'EMERGENCY'
  'WARNING'
  'NOTICE'    VBMEG default value
  'INFO'
  'DEBUG'     Displaying all messages

 [example]
 >> vb_set_verbose('WARNING');

 [note]
 If 'vbmeg_inst' does not exist, this function will ask if you want to
 terminate program or set some value to 'vbmeg_inst'.  

 [history]
 2010-12-07 Taku Yoshioka

 [see also]
 vb_set_verbose, vb_disp

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [verbose_level,verbose_str] = vb_get_verbose
0002 % Get verbose level from VBMEG environment (global) variable 'vbmeg_inst'.
0003 %
0004 % [syntax]
0005 % [verbose_level,verbose_str] = vb_get_verbose
0006 %
0007 % [input]
0008 %
0009 % [output]
0010 % verbose_level: <<int>> Verbose level value. Larger value supresses
0011 %                more messages.
0012 % verbose_str  : <<string>> Verbose level string.
0013 %  'NONE'      Suppressing all messages
0014 %  'EMERGENCY'
0015 %  'WARNING'
0016 %  'NOTICE'    VBMEG default value
0017 %  'INFO'
0018 %  'DEBUG'     Displaying all messages
0019 %
0020 % [example]
0021 % >> vb_set_verbose('WARNING');
0022 %
0023 % [note]
0024 % If 'vbmeg_inst' does not exist, this function will ask if you want to
0025 % terminate program or set some value to 'vbmeg_inst'.
0026 %
0027 % [history]
0028 % 2010-12-07 Taku Yoshioka
0029 %
0030 % [see also]
0031 % vb_set_verbose, vb_disp
0032 %
0033 % Copyright (C) 2011, ATR All Rights Reserved.
0034 % License : New BSD License(see VBMEG_LICENSE.txt)
0035 
0036 global vbmeg_inst;
0037 const = vb_define_verbose;
0038 
0039 if ~isfield(vbmeg_inst,'verbose_level')
0040   disp(['Input verbose level (following value) ' ...
0041         'or terminate program: ']);
0042   disp('NONE               (0)'); 
0043   disp('EMERGENCY          (1)');
0044   disp('WARNING            (2)');
0045   disp('NOTICE             (3)');
0046   disp('INFO               (5)');
0047   disp('DEBUG             (10)');
0048   disp('terminate program (-1)');
0049   
0050   v = str2num(input('? ','s'));
0051   
0052   if v==-1
0053     error('Terminate');
0054   else
0055     vbmeg_inst.verbose_level = v;
0056   end
0057 end
0058 
0059 verbose_level = vbmeg_inst.verbose_level;
0060 
0061 switch verbose_level
0062  case const.VERBOSE_LEVEL_NONE
0063   verbose_str = 'NONE';
0064  case const.VERBOSE_LEVEL_EMERGENCY
0065   verbose_str = 'EMERGENCY';
0066  case const.VERBOSE_LEVEL_WARNING
0067   verbose_str = 'WARNING';
0068  case const.VERBOSE_LEVEL_NOTICE
0069   verbose_str = 'NOTICE';
0070  case const.VERBOSE_LEVEL_INFO
0071   verbose_str = 'INFO';
0072  case const.VERBOSE_LEVEL_DEBUG
0073   verbose_str = 'DEBUG';
0074 end
0075 
0076 return;

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005