mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-09-19 01:58:05 +08:00
移除 SaLogInput 组件
This commit is contained in:
@@ -6,6 +6,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.fun.SaFunction;
|
||||
import cn.dev33.satoken.listener.SaTokenEventCenter;
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||
@@ -54,8 +55,8 @@ public class StpUserUtil {
|
||||
// 以便可以通过 SaManager.getStpLogic(type) 的方式来全局获取到这个 StpLogic
|
||||
SaManager.putStpLogic(newStpLogic);
|
||||
|
||||
// ## 发送日志
|
||||
SaManager.getLogInput().replaceStpLogic(stpLogic);
|
||||
// $$ 全局事件
|
||||
SaTokenEventCenter.doSetStpLogic(stpLogic);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,17 +1,19 @@
|
||||
package com.pj;
|
||||
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import org.noear.solon.Solon;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
|
||||
/**
|
||||
* sa-token整合 solon 示例
|
||||
* @author noear
|
||||
*
|
||||
*/
|
||||
public class SaTokenDemoApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Solon.start(SaTokenDemoApp.class, args);
|
||||
System.out.println("\n启动成功:sa-token配置如下:" + SaManager.getConfig());
|
||||
System.out.println("\n启动成功:Sa-Token配置如下:" + SaManager.getConfig());
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package com.pj.satoken;
|
||||
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.core.util.PrintUtil;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.config.SaTokenConfig;
|
||||
import cn.dev33.satoken.log.SaLog;
|
||||
import cn.dev33.satoken.log.SaLogForConsole;
|
||||
import cn.dev33.satoken.util.StrFormatter;
|
||||
|
||||
/**
|
||||
* 将 Sa-Token log 信息转接到 Slf4j
|
||||
*
|
||||
* @author kong
|
||||
* @since 2022-11-2
|
||||
*/
|
||||
@Component
|
||||
public class SaLogForSolon extends SaLogForConsole implements SaLog {
|
||||
|
||||
/**
|
||||
* 打印日志到控制台
|
||||
* @param level 日志等级
|
||||
* @param str 字符串
|
||||
* @param args 参数列表
|
||||
*/
|
||||
public void println(int level, String str, Object... args) {
|
||||
SaTokenConfig config = SaManager.getConfig();
|
||||
if(config.getIsLog() && level >= config.getLogLevelInt()) {
|
||||
PrintUtil.info(LOG_PREFIX + StrFormatter.format(str, args));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -17,7 +17,7 @@ sa-token:
|
||||
# token风格
|
||||
token-style: uuid
|
||||
# 是否输出操作日志
|
||||
is-log: false
|
||||
is-log: true
|
||||
|
||||
solon:
|
||||
# redis配置
|
||||
|
@@ -6,6 +6,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.fun.SaFunction;
|
||||
import cn.dev33.satoken.listener.SaTokenEventCenter;
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||
@@ -54,8 +55,8 @@ public class StpUserUtil {
|
||||
// 以便可以通过 SaManager.getStpLogic(type) 的方式来全局获取到这个 StpLogic
|
||||
SaManager.putStpLogic(newStpLogic);
|
||||
|
||||
// ## 发送日志
|
||||
SaManager.getLogInput().replaceStpLogic(stpLogic);
|
||||
// $$ 全局事件
|
||||
SaTokenEventCenter.doSetStpLogic(stpLogic);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user