haijiang
2018-06-25 586f13d3aa93fc3fdfed65021b1a17a17acf3321
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package com.moral.andbrickslib.utils.log;
 
/**
 * XLog is a wrapper of {@link android.util.Log}
 * But more pretty, simple and powerful
 */
public final class XLog {
  public static final int DEBUG = 3;
  public static final int ERROR = 6;
  public static final int ASSERT = 7;
  public static final int INFO = 4;
  public static final int VERBOSE = 2;
  public static final int WARN = 5;
 
  private static final String DEFAULT_TAG = "haijiang";
 
  private static Printer printer = new LoggerPrinter();
 
  //no instance
  private XLog() {
  }
 
  /**
   * It is used to get the settings object in order to change settings
   *
   * @return the settings object
   */
  public static Settings init() {
    return init(DEFAULT_TAG);
  }
 
  /**
   * It is used to change the tag
   *
   * @param tag is the given string which will be used in XLog as TAG
   */
  public static Settings init(String tag) {
    printer = new LoggerPrinter();
    return printer.init(tag);
  }
 
  public static void resetSettings() {
    printer.resetSettings();
  }
 
  public static Printer t(String tag) {
    return printer.t(tag, printer.getSettings().getMethodCount());
  }
 
  public static Printer t(int methodCount) {
    return printer.t(null, methodCount);
  }
 
  public static Printer t(String tag, int methodCount) {
    return printer.t(tag, methodCount);
  }
 
  public static void log(int priority, String tag, String message, Throwable throwable) {
    printer.log(priority, tag, message, throwable);
  }
 
  public static void d(String message, Object... args) {
    printer.d(message, args);
  }
 
  public static void d(Object object) {
    printer.d(object);
  }
 
  public static void e(String message, Object... args) {
    printer.e(null, message, args);
  }
 
  public static void e(Throwable throwable, String message, Object... args) {
    printer.e(throwable, message, args);
  }
 
  public static void i(String message, Object... args) {
    printer.i(message, args);
  }
 
  public static void v(String message, Object... args) {
    printer.v(message, args);
  }
 
  public static void w(String message, Object... args) {
    printer.w(message, args);
  }
 
  public static void wtf(String message, Object... args) {
    printer.wtf(message, args);
  }
 
  /**
   * Formats the json content and print it
   *
   * @param json the json content
   */
  public static void json(String json) {
    printer.json(json);
  }
 
  /**
   * Formats the json content and print it
   *
   * @param xml the xml content
   */
  public static void xml(String xml) {
    printer.xml(xml);
  }
 
}