-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetlogs.sh
63 lines (49 loc) · 1.82 KB
/
getlogs.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
#!/bin/bash
# Check if time period argument exists and set a default if not
if [ -z "$1" ]; then
t=1h
else
t=$1
fi
# Set default export folder and date format appended to files
d=$(date "+%Y-%m-%d_%H.%M")
f=~/Desktop/Sketch_Logs_$d
# Say hello :)
echo ""
echo " Let’s get them 💎 logs"
echo ""
sleep 1s
# Create folder where all will be exported
echo " Creating folder on Desktop…"
mkdir -p "$f"
# Get the Sketch Collaboration log from the system/console log
echo " Copying Collaboration logs…"
log show --last $t --predicate '(subsystem == "com.bohemiancoding.sketch3.xcode") && ((category == "collaboration") || (category == "collab-opener"))' --info >"$f/Collab-$d.log"
# Get the Sketch logs from the system/console log
echo " Copying Console logs…"
log show --last $t --predicate 'processImagePath CONTAINS[c] "Sketch"' --info >"$f/Console-$d.log"
# Find and get all the Sketch crash logs within the given period
echo " Copying Crash logs…"
find ~/Library/Logs/DiagnosticReports -mtime -$t -iname "*sketch*.crash" -exec cp {} "$f" \;
# Copy installed Sketch plugins list
echo " Copying Plugins list…"
cp ~/Library/Application\ Support/com.bohemiancoding.sketch3/crash.environment.log "$f/plugins.json"
# Copy Sketch preferences
echo " Copying Sketch preferences…"
find ~/Library/Preferences -mtime -$t -iname "*sketch3*.plist" -exec cp {} "$f" \;
# Get some basic OS/CPU/GPU info
echo " Copying anonymous system info…"
system_profiler -detaillevel mini SPDisplaysDataType SPHardwareDataType SPSoftwareDataType >"$f/system_info.txt"
# Zip it
echo ""
echo " Zipping it all up…"
zip -r -X -dd -j -q "$f.zip" "$f"
# Delete the folder
echo " Cleaning up…"
rm -rf "$f"
echo ""
echo " All done! 🎉"
echo " Please send back the Sketch Logs zip file. Thank you."
echo ""
# Reveal the zip file in Finder
open -R "$f.zip"