All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ssssssss.magicapi.logging.MagicLoggerContext Maven / Gradle / Ivy

package org.ssssssss.magicapi.logging;

import org.ssssssss.magicapi.config.MessageType;
import org.ssssssss.magicapi.config.WebSocketSessionManager;

public interface MagicLoggerContext {

	String LOGGER_NAME = "magic";

	ThreadLocal SESSION = new InheritableThreadLocal<>();

	/**
	 * 打印日志
	 *
	 * @param logInfo 日志信息
	 */
	static void println(LogInfo logInfo) {
		// 获取SessionId
		String sessionId = SESSION.get();
		if (sessionId != null) {
			WebSocketSessionManager.sendBySessionId(sessionId, MessageType.LOG, logInfo);
		}else{
			WebSocketSessionManager.sendToAll(MessageType.LOG, logInfo);
		}
	}

	/**
	 * 生成appender
	 */
	void generateAppender();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy