1 |
+ |
/* |
2 |
+ |
* i-scream central monitoring system |
3 |
+ |
* Copyright (C) 2000-2002 i-scream |
4 |
+ |
* |
5 |
+ |
* This program is free software; you can redistribute it and/or |
6 |
+ |
* modify it under the terms of the GNU General Public License |
7 |
+ |
* as published by the Free Software Foundation; either version 2 |
8 |
+ |
* of the License, or (at your option) any later version. |
9 |
+ |
* |
10 |
+ |
* This program is distributed in the hope that it will be useful, |
11 |
+ |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
+ |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
+ |
* GNU General Public License for more details. |
14 |
+ |
* |
15 |
+ |
* You should have received a copy of the GNU General Public License |
16 |
+ |
* along with this program; if not, write to the Free Software |
17 |
+ |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 |
+ |
*/ |
19 |
+ |
|
20 |
|
//---PACKAGE DECLARATION--- |
21 |
< |
package uk.org.iscream.util; |
21 |
> |
package uk.org.iscream.cms.server.util; |
22 |
|
|
23 |
|
//---IMPORTS--- |
24 |
|
import java.util.Date; |
83 |
|
* @return The string to be written to the log. |
84 |
|
*/ |
85 |
|
public static String formatLogLine(String source, int verbosity, String message){ |
86 |
< |
String date = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, Locale.UK).format(new Date()); |
86 |
> |
String date = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(new Date()); |
87 |
|
return "[" + date + "] [" + VERBOSITY_NAMES[verbosity] + "] " + source + ": " + message; |
88 |
|
} |
89 |
|
|
90 |
|
/** |
91 |
< |
* If the class name begins with uk.org.iscream |
91 |
> |
* If the class name begins with uk.org.iscream.cms.server |
92 |
|
* this method will trim it off, otherwise it |
93 |
|
* leaves the string unchanged. |
94 |
|
* |
97 |
|
* @return the tidy version of it |
98 |
|
*/ |
99 |
|
private static String tidyClassName(String className) { |
100 |
< |
if (className.startsWith("uk.org.iscream")) { |
101 |
< |
return className.substring(18); |
100 |
> |
String prefix = "uk.org.iscream.cms.server"; |
101 |
> |
if (className.startsWith(prefix)) { |
102 |
> |
return className.substring(prefix.length()+1); |
103 |
|
} |
104 |
|
return className; |
105 |
|
} |