当前位置:网站首页>Shell 日志与打印输出
Shell 日志与打印输出
2022-06-23 00:35:00 【ghostwritten】
Shell 日志与打印输出
良好的 shell 脚本从记录日志内容,规范日志格式开始。
1
write_log()
{
LOG_FILE=$LOGDIR/cckiller_$(date +%Y-%m-%d).log
logout=""
for((i=2;i<=$#;i++)); do
j=${
!i}
logout="${logout} $j "
done
if [[ $LOG_LEVEL == "INFO" ]] && [[ "$1" == "INFO" ]];then
echo "[`date "+%Y-%m-%d %H:%M:%S"`][$1]: ${logout}" | tee -ai $LOG_FILE
elif [[ $LOG_LEVEL == "DEBUG" ]];then
echo "[`date "+%Y-%m-%d %H:%M:%S"`][$1]: ${logout}" | tee -ai $LOG_FILE
else
echo "[`date "+%Y-%m-%d %H:%M:%S"`][$1]: ${logout}"
fi
}
边栏推荐
- Kunlundb query optimization (II) project and filter push down
- OLAP - Druid introduction
- 打新债到底靠不靠谱呀?是不是安全的?
- How Huawei cloud implements a global low delay network architecture for real-time audio and video [Part 1]
- How about China International Futures Co., Ltd.? Is it a regular futures company? Is it safe to open an account online?
- Hello, is the securities account presented by the Business School of qiniu business school safe? How can I open a safe stock account to speculate in stocks
- [PHP] PHP polymorphism
- #yyds干货盘点#尾递归比递归好在哪儿
- flowable 全局监听 监听流程的启动和流程的结束
- Is it reliable to get new debts? Is it safe?
猜你喜欢

SAP UI5 应用开发教程之一百零三 - 如何在 SAP UI5 应用中消费第三方库试读版

How do beginners get started quickly and learn deeply?

Database daily question - day 20: selling products by date

Isolation level of transaction system

KunlunDB 查询优化(一)

美团基于 Flink 的实时数仓平台建设新进展

Kunlundb query optimization (I)

黄金etf持仓量如何算

昆仑分布式数据库Sequence功能及其实现机制

数据库每日一题---第20天:按日期分组销售产品
随机推荐
13. Roman numeral to integer
How about China International Futures Co., Ltd.? Is it a regular futures company? Is it safe to open an account online?
掘地三尺搞定 Redis 与 MySQL 数据一致性问题
软件构造课程ADT与OOP理解
再立云计算“昆仑”,联想混合云Lenovo xCloud凭什么?
Fibonacci sequence set
Notes on zhouguohua's reading
flowable 全局监听 监听流程的启动和流程的结束
SAP UI5 应用开发教程之一百零二 - SAP UI5 应用的打印(Print)功能实现详解
Express, route, request object, response object, middleware, EJS template
【GO】Go数组和切片(动态数组)
一文简述:钓鱼攻击知多少
昆仑分布式数据库Sequence功能及其实现机制
Which brokerage platform is better and safer for a brokerage to open an account on a mobile phone? What if you need a low commission
语义分割新范式!StructToken:对per-pixel 分类范式的重新思考
华为云招募工业智能领域合作伙伴,强力扶持+商业变现
Database daily question - day 20: selling products by date
打新债开户安全么,怎么开
Various schemes for lazy loading of pictures
每日刷题记录 (一)