Project

General

Profile

« Previous | Next » 

Revision 1053

Added by Jing Tao over 22 years ago

Overload a method debugMessage(String msg, int debugLevel)
User can set a debugLevel for this message. If debugLevel is less than the default a value in build.xml, this message will be printed.
If user set a value less than or equals 0, debugLevel will be set automatically to 1. So we can set default value to 0 in build.xml file and close all debug message.

View differences:

src/edu/ucsb/nceas/metacat/MetaCatUtil.java
361 361
    return parameters;
362 362
  }
363 363

  
364
   /** 
365
   * Utility method to print debugging messages. User can set debug level
366
   * for this message. The number is fewer, the message is more important
367
   * @param msg, the content of the message
368
   * @param debugLevel, an integer indicating the message debug leve
369
   */
370
  public static void debugMessage(String msg, int debugLevel) 
371
  {
372
    int limit = 1;
373
    try 
374
    {
375
      limit=Integer.parseInt(getOption("debuglevel"));
376
     
377
    }
378
    catch (Exception e)
379
    {
380
      System.out.println(e.getMessage());
381
    }
382
    //don't allow the user set debugLevel less than or equals 0
383
    if (debugLevel<=0)
384
    {
385
      debugLevel=1;
386
    }
387
    
388
    if (debugLevel < limit) 
389
    {
390
      System.err.println(msg);
391
    }
392
  }
393
  
364 394
  /** 
365 395
   * Utility method to print debugging messages
366 396
   *
......
391 421
    }
392 422
  }
393 423
  
424
  
425
  
394 426
  public static Vector getOptionList(String optiontext)
395 427
  {
396 428
    Vector options = new Vector();

Also available in: Unified diff