-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtlog
executable file
·55 lines (47 loc) · 1.16 KB
/
tlog
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
#! /usr/bin/env bash
logdirs="./ log/ logs/"
logfile="test.log"
help="Usage: `basename $0` [logfilename]
Options: none
This script will run a 'tail -f' operation on the specified log file
(default: ${logfile}), filtering out DatabaseCleaner-specific strings
as it goes.
If no directory is specified in the logfilename and the file does not exist in
the current directory, then 'log/' and 'logs/' will be prepended to the name to
see if it resides in either of those known subdirectories. If not found then
the command will fail.
"
case $# in
0) logfile=test.log
;;
1) logfile=$1
;;
*)
echo 1>&2 "?Wrong number of arguments: $*"
echo 1>&2 "$help"
exit 1
;;
esac
logpath=""
case $logfile in
*/*) logpath=$logfile;;
*)
for dir in $logdirs
do
test -f $dir$logfile && {
logpath="$dir$logfile"
break
}
done
esac
case $logpath in
"")
echo 1>&2 "?$logfile not found in any of: $logdirs"
echo 1>&2 "$help"
exit 2
;;
*)
echo 1>&2 "Filtering tail of $logpath..."
;;
esac
tail -f $logpath | egrep --line-buffered -v "TRIGGER|TRUNCATE|NoMethodError: undefined method .example_group."