|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.mj.impl.rt.midp; |
|
19 |
|
20 import com.nokia.mj.impl.utils.Logger; |
|
21 |
|
22 /** |
|
23 * A utility class for logging. |
|
24 * |
|
25 * @author Nokia Corporation |
|
26 * @version $Rev$ |
|
27 */ |
|
28 |
|
29 |
|
30 public final class Log |
|
31 { |
|
32 |
|
33 /** Logger component id */ |
|
34 private static final int COMPONENT_ID = Logger.EJavaRuntime; |
|
35 |
|
36 public static final boolean mOn = false; |
|
37 |
|
38 /** |
|
39 * Writes info log message. |
|
40 * @param msg log message |
|
41 */ |
|
42 public static void logI(String msg) |
|
43 { |
|
44 Logger.ILOG(COMPONENT_ID, msg); |
|
45 } |
|
46 |
|
47 /** |
|
48 * Writes infoPrd log message. |
|
49 * @param msg log message |
|
50 */ |
|
51 public static void logP(String msg) |
|
52 { |
|
53 Logger.PLOG(COMPONENT_ID, msg); |
|
54 } |
|
55 |
|
56 /** |
|
57 * Writes warning log message. |
|
58 * @param msg log message |
|
59 */ |
|
60 public static void logW(String msg) |
|
61 { |
|
62 Logger.WLOG(COMPONENT_ID, msg); |
|
63 } |
|
64 |
|
65 /** |
|
66 * Writes warning log message. |
|
67 * @param msg log message |
|
68 * @param t Throwable to be logged |
|
69 */ |
|
70 public static void logW(String msg, Throwable t) |
|
71 { |
|
72 if (t == null) |
|
73 { |
|
74 Logger.WLOG(COMPONENT_ID, msg); |
|
75 } |
|
76 else |
|
77 { |
|
78 Logger.WLOG(COMPONENT_ID, msg, t); |
|
79 } |
|
80 } |
|
81 |
|
82 /** |
|
83 * Writes error log message. |
|
84 * @param msg log message |
|
85 */ |
|
86 public static void logE(String msg) |
|
87 { |
|
88 Logger.ELOG(COMPONENT_ID, msg); |
|
89 } |
|
90 |
|
91 /** |
|
92 * Writes error log message. |
|
93 * @param msg log message |
|
94 * @param t Throwable to be logged |
|
95 */ |
|
96 public static void logE(String msg, Throwable t) |
|
97 { |
|
98 if (t == null) |
|
99 { |
|
100 Logger.ELOG(COMPONENT_ID, msg); |
|
101 } |
|
102 else |
|
103 { |
|
104 Logger.ELOG(COMPONENT_ID, msg, t); |
|
105 } |
|
106 } |
|
107 } |