1 /*
2 * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
26 package sun.awt.X11;
27
28 import java.util.logging.*;
29 import java.text.*;
30 import java.util.*;
31 import java.io.*;
32
33 /**
34 * Formatter class providing ANSI output. Based on java.util.logging.SimpleFormatter sources.
35 */
36
37 public class XAWTFormatter extends java.util.logging.Formatter {
38 Date dat = new Date();
39 private final static String format = "{0,date} {0,time}";
40 private MessageFormat formatter;
41
42 private Object args[] = new Object[1];
43
44 // Line separator string. This is the value of the line.separator
45 // property at the moment that the SimpleFormatter was created.
46 private String lineSeparator = (String) java.security.AccessController.doPrivileged(
47 new sun.security.action.GetPropertyAction("line.separator"));
48
49 boolean displayFullRecord = false;
50 boolean useANSI = false;
51 boolean showDate = true;
52 boolean showLevel = true;
53 boolean swapMethodClass = false;
54 public XAWTFormatter() {
55 displayFullRecord = "true".equals(LogManager.getLogManager().getProperty("XAWTFormatter.displayFullRecord"));
56 useANSI = "true".equals(LogManager.getLogManager().getProperty("XAWTFormatter.useANSI"));
57 showDate = !"false".equals(LogManager.getLogManager().getProperty("XAWTFormatter.showDate"));
58 showLevel = !"false".equals(LogManager.getLogManager().getProperty("XAWTFormatter.showLevel"));
59 swapMethodClass = "true".equals(LogManager.getLogManager().getProperty("XAWTFormatter.swapMethodClass"));
60 }
61
62 /**
63 * Format the given LogRecord.
64 * @param record the log record to be formatted.
65 * @return a formatted log record
66 */
|
1 /*
2 * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
26 package sun.awt.X11;
27
28 import java.util.logging.*;
29 import java.text.*;
30 import java.util.*;
31 import java.io.*;
32
33 /**
34 * Formatter class providing ANSI output. Based on java.util.logging.SimpleFormatter sources.
35 */
36
37 public class XAWTFormatter extends java.util.logging.Formatter {
38 Date dat = new Date();
39 private final static String format = "{0,date} {0,time}";
40 private MessageFormat formatter;
41
42 private Object args[] = new Object[1];
43
44 // Line separator string. This is the value of the line.separator
45 // property at the moment that the SimpleFormatter was created.
46 private String lineSeparator = java.security.AccessController.doPrivileged(
47 new sun.security.action.GetPropertyAction("line.separator"));
48
49 boolean displayFullRecord = false;
50 boolean useANSI = false;
51 boolean showDate = true;
52 boolean showLevel = true;
53 boolean swapMethodClass = false;
54 public XAWTFormatter() {
55 displayFullRecord = "true".equals(LogManager.getLogManager().getProperty("XAWTFormatter.displayFullRecord"));
56 useANSI = "true".equals(LogManager.getLogManager().getProperty("XAWTFormatter.useANSI"));
57 showDate = !"false".equals(LogManager.getLogManager().getProperty("XAWTFormatter.showDate"));
58 showLevel = !"false".equals(LogManager.getLogManager().getProperty("XAWTFormatter.showLevel"));
59 swapMethodClass = "true".equals(LogManager.getLogManager().getProperty("XAWTFormatter.swapMethodClass"));
60 }
61
62 /**
63 * Format the given LogRecord.
64 * @param record the log record to be formatted.
65 * @return a formatted log record
66 */
|