1 24 31 32 package org.datashare.plugins.LoggingManager; 33 34 import org.datashare.LoggingInterface; 35 import org.datashare.SessionUtilities; 36 37 43 public class LoggingAdapter implements LoggingInterface 44 { 45 46 54 public void debugMsg(int level, int category, String msg) 55 { 56 switch(level) 57 { 58 case LoggingInterface.DEBUG: 59 case LoggingInterface.WARNING: 60 if(SessionUtilities.getVerbose()) 61 System.out.println(levelStrings[level] + " " + categoryStrings[category] + " " + msg); 62 break; 63 case LoggingInterface.ERROR: 64 case LoggingInterface.FATALERROR: 65 System.err.println(levelStrings[level] + " " + categoryStrings[category] + " " + msg); 66 } 67 } 68 69 74 public void logException(int level, Exception e) 75 { 76 switch(level) 77 { 78 case LoggingInterface.DEBUG: 79 case LoggingInterface.WARNING: 80 if(SessionUtilities.getVerbose()) 81 e.printStackTrace(); 82 break; 83 case LoggingInterface.ERROR: 84 case LoggingInterface.FATALERROR: 85 e.printStackTrace(System.err); 86 break; 87 } 88 } 89 90 } 91 92 | Popular Tags |