-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
我已经好久都没有给这个储存库打tag了,毕竟以前刚开始学干了很多拆东墙补西墙的事情 现在算是稳定了吧,所以 来合并到主线吧
- Loading branch information
Showing
12 changed files
with
241 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/devtest | ||
/.vscode | ||
/src/log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# 写日志咯 | ||
llib_logger(){ | ||
LogPath=$LogPath | ||
LogName=$LogName | ||
|
||
case $1 in | ||
both) | ||
echo $2 | ||
if [[ -z $3 ]];then | ||
echo "[$(date +%T)] [$1] $2" >> $LogPath/$LogName | ||
else | ||
# 如果有第三个参数就向文件内写入单独的内容 | ||
echo "[$(date +%T)] [$1] $3" >> $LogPath/$LogName | ||
fi | ||
;; | ||
term) | ||
echo $2 | ||
;; | ||
file) | ||
echo "[$(date +%T)] [$1] $2" >> $LogPath/$LogName | ||
;; | ||
stdin) | ||
# 管道输入模式 | ||
# 执行到这里tee就会开始请求标准输入,有输入后就会将内容附加到后面的文件里实现从管道输入读取命令输出 | ||
tee -a $LogPath/$LogName | ||
;; | ||
init) | ||
# 检测并创建log文件夹 | ||
if [[ ! -d $LogPath ]]; then | ||
llib_logger 'file' "$(mkdir -vp $LogPath || exit 1)" | ||
fi | ||
# 清空日志 | ||
> $LogPath/$LogName || exit 1 | ||
# 写入日志 | ||
llib_logger 'file' "$(date +%s_%Y-%m-%d_%T) $0" | ||
;; | ||
*) | ||
# 保留缺省情况 | ||
echo $@ | ||
echo "[$(date +%T)] $@" >> $LogPath/$LogName | ||
;; | ||
esac | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
|
||
# 循环输出数组内的值 | ||
println_array_items(){ | ||
llib_println_array_items(){ | ||
for i in $@; do | ||
echo $i | ||
done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
|
||
# 分隔线函数 | ||
separator(){ | ||
llib_separator(){ | ||
if [[ -z $1 ]] || [[ ! ${#1} -eq 1 ]]; then | ||
Character='=' | ||
else | ||
|
Oops, something went wrong.