View Javadoc

1   /**
2    * Logback: the generic, reliable, fast and flexible logging framework.
3    * 
4    * Copyright (C) 2000-2008, QOS.ch
5    * 
6    * This library is free software, you can redistribute it and/or modify it under
7    * the terms of the GNU Lesser General Public License as published by the Free
8    * Software Foundation.
9    */
10  package ch.qos.logback.core.status;
11  
12  import ch.qos.logback.core.Context;
13  
14  public class StatusUtil {
15  
16    static public void addStatus(Context context, Status status) {
17      if (context == null) {
18        return;
19      }
20      StatusManager sm = context.getStatusManager();
21      if (sm != null) {
22        sm.add(status);
23      }
24    }
25   
26    static public void addInfo(Context context, Object caller, String msg) {
27      addStatus(context, new InfoStatus(msg, caller));
28    }
29  
30    static public void addWarn(Context context, Object caller, String msg) {
31      addStatus(context, new WarnStatus(msg, caller));
32    }
33    
34    static public void addError(Context context, Object caller, String msg,
35        Throwable t) {
36      addStatus(context, new ErrorStatus(msg, caller, t));
37    }
38  }