-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_logging.sh
executable file
·64 lines (54 loc) · 926 Bytes
/
test_logging.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
#!/bin/bash
BASE_DIR="$(dirname "${BASH_SOURCE}")"
source "${BASE_DIR}/logging.sh"
info_log "argument"
info_log <<<"stdin"
echo "pipe" | info_log
echo "redirection" &> >(info_log)
info_log <<EOF
multi
line
EOF
echo
error_log "error"
warn_log "warning"
info_log "info"
debug_log "debug"
trace_log "trace"
echo
LOG_LEVEL=${TRACE}
value_of LOG_LEVEL
info_log "$(value_of LOG_LEVEL)"
value_of LOG_LEVEL | info_log
echo
error_log "error"
warn_log "warning"
info_log "info"
debug_log "debug"
trace_log "trace"
echo
add_log_target test.log
error_log "error"
warn_log "warning"
info_log "info"
debug_log "debug"
trace_log "trace"
echo
add_log_target SYSLOG
error_log "error"
warn_log "warning"
info_log "info"
debug_log "debug"
trace_log "trace"
function func2() {
debug_log "foo"
debug_log <<<"bar"
print_stack_trace
print_stack_trace | info_log
}
function func1() {
debug_log "foo"
debug_log <<<"bar"
func2
}
func1