1 Star 0 Fork 0

HuJunFeng/http-server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
日志格式设计.txt 721 Bytes
一键复制 编辑 原始数据 按行查看 历史
HuJunFeng 提交于 2024-12-21 20:43 +08:00 . ok
// 日志格式设计:
%Y 年份
%M 月份
%D 日期
%H 小时
%m 分钟
%s 秒
%S 毫秒数
%msg 消息体
public String format(String msg){
Date date = new Date();
return template.replaceAll("%Y", date.getYear())
.replaceAll("%M", String.valueOf(date.getMonth() + 1))
.replaceAll("%D", String.valueOf(date.getDay()))
.replaceAll("%H", String.valueOf(date.getHour()))
.replaceAll("%m", String.valueOf(date.getMinutes()))
.replaceAll("%s", String.valueOf(date.getSeconds()))
.replaceAll("%S", String.valueOf(date.getTime()))
.replaceAll("%W", String.valueOf(date.getWeek()))
.("%msg", msg);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/hujunfeng123456/http-server.git
git@gitee.com:hujunfeng123456/http-server.git
hujunfeng123456
http-server
http-server
master

搜索帮助