Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d9b19aad6e808bae2d345feb50098c5cbec5145e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*****************************************************************************
 * Copyright (c) 2012 Cedric Dumoulin.
 *
 *    
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Cedric Dumoulin  Cedric.dumoulin@lifl.fr - Initial API and implementation
 *
 *****************************************************************************/

package org.eclipse.papyrus.infra.core.sasheditor.tests.utils.trace;


/**
 * Instances of this class are used to log traces of a namespace.
 * 
 * @author Cedric Dumoulin
 *
 */
public class TraceLogger {

	/**
	 * The namespace used to tag records.
	 */
	protected String namespace;

	/**
	 * The records
	 */
	protected ITraceRecords records;
	
	/**
	 * Constructor.
	 * A logger logging nothing.
	 *
	 * @param namespace
	 */
	public TraceLogger(String namespace, boolean isRecording) {
		this.namespace = namespace;
		this.records = TraceRecordsFactory.createTraceRecords(isRecording);
	}

	/**
	 * Constructor.
	 *
	 * @param namespace
	 * @param records
	 */
	public TraceLogger(String namespace, ITraceRecords records) {
		this.namespace = namespace;
		this.records = records;
	}

	
	/**
	 * @return the records
	 */
	public ITraceRecords getTraceRecords() {
		return records;
	}

	
	/**
	 * @param records the records to set
	 */
	public void setTraceRecords(ITraceRecords records) {
		this.records = records;
	}

	
	/**
	 * @return the namespace
	 */
	public String getNamespace() {
		return namespace;
	}

	
	/**
	 * @param namespace the namespace to set
	 */
	public void setNamespace(String namespace) {
		this.namespace = namespace;
	}

	/**
	 * Record a new trace.
	 * @param trace
	 */
	public void trace(String trace) {
		records.addTrace(namespace, trace, (Object)null);
	}
	
	/**
	 * Record a new trace.
	 * @param trace
	 */
	public void trace(String trace, Object value) {
		records.addTrace( namespace, trace, value);
	}
	
	/**
	 * Record a new trace.
	 * @param trace
	 */
	public void trace(String trace, Object ... values) {
		records.addTrace( namespace, trace, values);
	}
	

}

Back to the top