~ubuntu-branches/ubuntu/saucy/ivy/saucy-proposed

« back to all changes in this revision

Viewing changes to src/java/org/apache/ivy/util/Message.java

  • Committer: Package Import Robot
  • Author(s): tony mancill
  • Date: 2013-05-15 17:44:57 UTC
  • mfrom: (3.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130515174457-ogntd0vxluwalq11
Tags: 2.3.0-2
* Team upload.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    /** Message priority of "debug". */
50
50
    public static final int MSG_DEBUG = 4;
51
51
 
52
 
 
53
52
    private static boolean showedInfo = false;
54
53
 
55
54
    private static MessageLogger defaultLogger = new DefaultMessageLogger(Message.MSG_INFO);
56
55
 
57
56
    /**
58
57
     * Returns the current default logger.
 
58
     * 
59
59
     * @return the current default logger; is never <code>null</code>.
60
60
     */
61
61
    public static MessageLogger getDefaultLogger() {
64
64
 
65
65
    /**
66
66
     * Change the default logger used when no other logger is currently configured
67
 
     * @param logger the new default logger, must not be <code>null</code>
 
67
     * 
 
68
     * @param logger
 
69
     *            the new default logger, must not be <code>null</code>
68
70
     */
69
71
    public static void setDefaultLogger(MessageLogger logger) {
70
72
        Checks.checkNotNull(logger, "logger");
77
79
 
78
80
    public static void showInfo() {
79
81
        if (!showedInfo) {
80
 
            info(":: Ivy " + Ivy.getIvyVersion() + " - "
 
82
            info(":: Apache Ivy " + Ivy.getIvyVersion() + " - "
81
83
                   + Ivy.getIvyDate() + " :: " + Ivy.getIvyHomeURL() + " ::");
82
84
            showedInfo = true;
83
85
        }
111
113
        getLogger().error(msg);
112
114
    }
113
115
 
 
116
    public static void log(int logLevel, String msg) {
 
117
        switch (logLevel) {
 
118
            case MSG_DEBUG:
 
119
                debug(msg);
 
120
                break;
 
121
            case MSG_VERBOSE:
 
122
                verbose(msg);
 
123
                break;
 
124
            case MSG_INFO:
 
125
                info(msg);
 
126
                break;
 
127
            case MSG_WARN:
 
128
                warn(msg);
 
129
                break;
 
130
            case MSG_ERR:
 
131
                error(msg);
 
132
                break;
 
133
            default:
 
134
                throw new IllegalArgumentException("Unknown log level " + logLevel);
 
135
        }
 
136
    }
 
137
 
114
138
    public static List getProblems() {
115
139
        return getLogger().getProblems();
116
140
    }