1 package org.codehaus.plexus.logging;
2
3 /*
4 * Copyright 2001-2006 Codehaus Foundation.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 /**
20 * @author Jason van Zyl
21 * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
22 */
23 public abstract class AbstractLoggerManager implements LoggerManager {
24 /** */
25 public AbstractLoggerManager() {}
26
27 public void setThreshold(String role, int threshold) {
28 setThreshold(role, null, threshold);
29 }
30
31 public int getThreshold(String role) {
32 return getThreshold(role, null);
33 }
34
35 public Logger getLoggerForComponent(String role) {
36 return getLoggerForComponent(role, null);
37 }
38
39 public void returnComponentLogger(String role) {
40 returnComponentLogger(role, null);
41 }
42
43 /**
44 * Creates a string key useful as keys in <code>Map</code>'s.
45 *
46 * @param role The component role.
47 * @param roleHint The component role hint.
48 * @return Returns a string thats useful as a key for components.
49 */
50 protected String toMapKey(String role, String roleHint) {
51 if (roleHint == null) {
52 return role;
53 } else {
54 return role + ":" + roleHint;
55 }
56 }
57 }