Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1. /* so rather than allowing
  2.  
  3. System.out.println(""); throughout the code at random intervals for logging sake
  4.  
  5. we will have a class called
  6.  
  7. Logger or Msg (I'll pick the name later or you can give me an idea)
  8.  
  9.  
  10. When the app is started:
  11. */
  12.  
  13.  
  14. public static void main(String args[])
  15. {
  16.     **get some stuff from console
  17.     Logger.setLogLevel(*based on CLI*);
  18.     Logger.setLogFile *default unless otherwise specified)
  19. }
  20.  
  21.  
  22.  
  23. class Logger
  24. {
  25.     //log levels are defined here
  26.     public final int ECHO_TO_CONSOLE;
  27.     public final int ALL_MESSAGES;
  28.     public final int ERRORS_ONLY;
  29.     public final int RUNTIME_MESSAGES;
  30.     public final int DEBUG_MESSAGES;
  31. ...
  32.  
  33.    
  34. }
  35.  
  36.  
  37. then in your code you would have Logger.error("some text here");
  38. or Logger.console("something something");
  39. and based on the log level set in at application start or during runtime will change whats logged to disk and whats logged to console or whats supressed except for debugging
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement