comparison dwtx/core/commands/util/Tracing.d @ 3:6518c18a01f7

eclipse.core package without osgi dependencies
author Frank Benoit <benoit@tionex.de>
date Wed, 26 Mar 2008 00:57:19 +0100
parents
children
comparison
equal deleted inserted replaced
2:a012107a911c 3:6518c18a01f7
1 /*******************************************************************************
2 * Copyright (c) 2005, 2006 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/
13
14 module dwtx.core.commands.util.Tracing;
15
16 import dwt.dwthelper.utils;
17 import tango.util.log.Trace;
18
19 static import tango.text.Text;
20 alias tango.text.Text.Text!(char) StringBuffer;
21
22 /**
23 * <p>
24 * A utility class for printing tracing output to the console.
25 * </p>
26 * <p>
27 * Clients must not extend or instantiate this class.
28 * </p>
29 *
30 * @since 3.2
31 */
32 public final class Tracing {
33
34 /**
35 * The separator to place between the component and the message.
36 */
37 public static const String SEPARATOR = " >>> "; //$NON-NLS-1$
38
39 /**
40 * <p>
41 * Prints a tracing message to standard out. The message is prefixed by a
42 * component identifier and some separator. See the example below.
43 * </p>
44 *
45 * <pre>
46 * BINDINGS &gt;&gt; There are 4 deletion markers
47 * </pre>
48 *
49 * @param component
50 * The component for which this tracing applies; may be
51 * <code>null</code>
52 * @param message
53 * The message to print to standard out; may be <code>null</code>.
54 */
55 public static final void printTrace(String component,
56 String message) {
57 StringBuffer buffer = new StringBuffer();
58 if (component.length !is 0) {
59 buffer.append(component);
60 }
61 if ((component.length !is 0) && (message.length !is 0)) {
62 buffer.append(SEPARATOR);
63 }
64 if (message.length !is 0) {
65 buffer.append(message);
66 }
67 Trace.formatln( "{}", buffer.toString());
68 }
69
70 /**
71 * This class is not intended to be instantiated.
72 */
73 private this() {
74 // Do nothing.
75 }
76 }