
wee0.log.LogContext Maven / Gradle / Ivy
The newest version!
/**
* Copyright (c) 2016-2022, wee0.com.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package wee0.log;
/**
* 日志上下文数据交换空间操作门面类。
* @author baihw
* @date 2018年3月16日
**/
/**
* * examples:
*
**/
public final class LogContext{
/**
* 设置数据
*
* @param key 键名
* @param val 键值
* @return 当前对象,方便链式调用。
*/
public static ILogContext set( String key, String val ){
return LoggerFactory.getLogContext().set( key, val );
}
/**
* 获取数据
*
* @param key 键名
* @param defVal 不存在时的默认值
* @return 当前对象,方便链式调用。
*/
public static String get( String key, String defVal ){
return LoggerFactory.getLogContext().get( key, defVal );
}
/**
* 移除指定键名数据。
*
* @param key 键名
* @return 当前对象,方便链式调用。
*/
public static ILogContext remove( String key ){
return LoggerFactory.getLogContext().remove( key );
}
/**
* 清除数据
*/
public static void clear(){
LoggerFactory.getLogContext().clear();
}
} // end class