-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathlogger.sh
88 lines (69 loc) · 1.84 KB
/
logger.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
###################################################################
# Description :
# Utility functions to perform logging.
#
###################################################################
readonly BOLD=$(tput bold)
export NORMAL=$(tput sgr0)
readonly BLUE="\\033[1;34m"
readonly RED="\\033[1;31m"
readonly GREEN="\\033[1;32m"
readonly YELLOW="\\033[1;33m"
readonly MAGENTA="\\033[1;35m"
readonly GRAS="\033[1m"
readonly END="\\033[1;00m"
readonly CHECK_MARK="\xE2\x9C\x94"
readonly SUFFIX="TEZART"
####
## Display url link in output
## $1 message
## $2 url
log::url() {
echo -e "\\e]8;;http://example.com\\aThis is a hyperlink\e]8;;\\a"
}
log::error() {
echo -e "\n$RED [ERROR:$SUFFIX] $* $END" >&2
}
log::error_and_exit() {
echo -e "\n$RED [ERROR:$SUFFIX] $*\n $END" >&2 && exit 1
}
log::info() {
echo -e "\n$GREEN [INFO:$SUFFIX]$END $* $END"
}
log::info_success() {
echo -e "\n$GREEN [INFO:$SUFFIX]$END $* $GREEN $CHECK_MARK $END"
}
log::info_and_exit() {
echo -e "\n$GREEN [INFO:$SUFFIX] $* $END" && exit 0
}
log::debug() {
[[ -n $DEBUG ]] && echo -e "\n$BLUE [DEBUG:$SUFFIX---] $* $END"
}
log::warn() {
echo -e "\n$YELLOW [WARN:$SUFFIX] $* $END"
}
log::warn_and_exit() {
echo -e "\n$YELLOW [WARN:$SUFFIX] $* $END" && exit 0
}
log::message_success() {
echo -e " $* $GREEN $CHECK_MARK $END"
}
log::message_error() {
echo -e " $* $RED x $END"
}
log::title() {
echo -e "\n $* "
}
log::title_success() {
echo -e "\n $GREEN [✓] $END $* "
}
log::title_warning() {
echo -e "\n $YELLOW [!] $END $* "
}
log::message() {
echo -e " $* "
}
log::application(){
echo -e "\n\n$GREEN$(cat $BASEDIR/../tool/info-tezart)$END"
}