SF.net SVN: tuotoo: [7] trunk/src/org/tuotoo/logging/LogHolder.java
Status: Pre-Alpha
Brought to you by:
hanru
|
From: <ha...@us...> - 2007-11-26 11:02:11
|
Revision: 7
http://tuotoo.svn.sourceforge.net/tuotoo/?rev=7&view=rev
Author: hanru
Date: 2007-11-26 03:02:15 -0800 (Mon, 26 Nov 2007)
Log Message:
-----------
imporve a bit on this class.
Modified Paths:
--------------
trunk/src/org/tuotoo/logging/LogHolder.java
Modified: trunk/src/org/tuotoo/logging/LogHolder.java
===================================================================
--- trunk/src/org/tuotoo/logging/LogHolder.java 2007-11-26 08:29:55 UTC (rev 6)
+++ trunk/src/org/tuotoo/logging/LogHolder.java 2007-11-26 11:02:15 UTC (rev 7)
@@ -162,15 +162,15 @@
return;
}
- if (isLogged(a_logLevel, a_logType)) {
+ if (canLogged(a_logLevel, a_logType)) {
String message = "";
if (a_message != null && a_message.length() > 0) {
message = a_message;
}
if (m_messageDetailLevel <= DETAIL_LEVEL_LOWEST) {
- getInstance().getLogInstance().log(a_logLevel, a_logType,
- a_throwable.getMessage());
+ ms_logInstance.log(a_logLevel, a_logType, a_throwable
+ .getMessage());
} else if (m_messageDetailLevel > DETAIL_LEVEL_LOWEST
&& m_messageDetailLevel < DETAIL_LEVEL_HIGHEST) {
if (message.length() == 0) {
@@ -180,8 +180,8 @@
+ a_throwable.getMessage();
}
- getInstance().getLogInstance().log(a_logLevel, a_logType,
- a_throwable.toString());
+ ms_logInstance.log(a_logLevel, a_logType, a_throwable
+ .toString());
} else if (m_messageDetailLevel == DETAIL_LEVEL_HIGH) {
if (message.length() == 0) {
message = a_throwable.toString();
@@ -189,12 +189,10 @@
message += "\n" + LOGGED_THROWABLE + a_throwable.toString();
}
- getInstance().getLogInstance().log(
- a_logLevel,
- a_logType,
- Util.normaliseString(getCallingClassFile(false) + ": ",
- LINE_LENGTH_HIGH_DETAIL)
- + message);
+ ms_logInstance.log(a_logLevel, a_logType, Util.normaliseString(
+ getCallingClassFile(false) + ": ",
+ LINE_LENGTH_HIGH_DETAIL)
+ + message);
} else if (m_messageDetailLevel >= DETAIL_LEVEL_HIGHEST) {
if (message.length() == 0) {
message = Util.getStackTrace(a_throwable);
@@ -203,12 +201,10 @@
+ Util.getStackTrace(a_throwable);
}
- getInstance().getLogInstance().log(
- a_logLevel,
- a_logType,
- Util.normaliseString(getCallingMethod(false) + ": ",
- LINE_LENGTH_HIGHEST_DETAIL)
- + message);
+ ms_logInstance.log(a_logLevel, a_logType, Util.normaliseString(
+ getCallingMethod(false) + ": ",
+ LINE_LENGTH_HIGHEST_DETAIL)
+ + message);
}
}
}
@@ -230,7 +226,7 @@
*/
public static void log(int logLevel, int logType, String message,
boolean a_bAddCallingClass) {
- if (isLogged(logLevel, logType)) {
+ if (canLogged(logLevel, logType)) {
if (m_messageDetailLevel <= DETAIL_LEVEL_LOWEST) {
ms_logInstance.log(logLevel, logType, message);
} else if (m_messageDetailLevel == DETAIL_LEVEL_LOWER) {
@@ -281,9 +277,9 @@
* The instance of a Log implementation.
*/
public static synchronized void setLogInstance(Log logInstance) {
- getInstance().ms_logInstance = logInstance;
- if (getInstance().ms_logInstance == null) {
- getInstance().ms_logInstance = new DummyLog();
+ ms_logInstance = logInstance;
+ if (ms_logInstance == null) {
+ ms_logInstance = new DummyLog();
}
}
@@ -310,7 +306,7 @@
return ms_logInstance;
}
- private static boolean isLogged(int a_logLevel, int a_logType) {
+ private static boolean canLogged(int a_logLevel, int a_logType) {
return (a_logLevel <= ms_logInstance.getLogLevel())
&& ((a_logType & ms_logInstance.getLogType()) == a_logType);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|