-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJamfLog.sublime-syntax
More file actions
135 lines (110 loc) · 4.17 KB
/
JamfLog.sublime-syntax
File metadata and controls
135 lines (110 loc) · 4.17 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
%YAML 1.2
---
# James Corcoran 2021
# https://github.com/jorks/sublime-jamflog
# Development Tips
#
# See http://www.sublimetext.com/docs/3/syntax.html
# macOS Keyboard shortcut to show scope Ctl + Shift + P
#### Syntax Definition ####
file_extensions:
- log
first_line_match: '^\d{4}\-\d{2}\-\d{2}.\d{2}\:\d{2}\:\d{2}\,\d{3}\s\['
# Default Scope
scope: text.jamflog
contexts:
# The main context is the initial starting point of our syntax
main:
# Include other contexts - the order is important
- include: timestamp
- include: helpfuls
- include: function
- include: thread
- include: severity
- include: exception
- include: stack
- include: inlinexml
# New line starting with a timestamp
timestamp:
# Newline with date formatted based on digit counts
# 10.31 - added a . as some timestamps have a random T
- match: '^(\d{4}\-\d{2}\-\d{2}.\d{2}\:\d{2}\:\d{2}\,\d{3})'
scope: constant.numeric.jamflog timestamp.jamflog
# Helpfuls let me highlight message content
helpfuls:
# Messages in the log string that should be highlighted
- match: 'Jamf Pro Version:'
scope: invalid.deprecated.jamflog startstop.thread.jamflog
- match: 'Turning debug mode on\.'
scope: invalid.deprecated.jamflog startstop.thread.jamflog
- match: 'Turning debug mode off\.'
scope: invalid.deprecated.jamflog startstop.thread.jamflog
- match: 'JAMF JSS DataSource Connection Pool'
scope: invalid.deprecated.jamflog startstop.thread.jamflog
# Function brackets
function:
# Matched but unused
- match: '\[.{25}\]'
scope: entity.name.label.jamflog unused.function.jamflog
# Thread brackets
thread:
# Match StartStops
- match: '(\[)(startStop\-\d)(\])'
captures:
1: punctuation.definition.tag.begin.jamflog peripheral.thread.jamflog
2: invalid.deprecated.jamflog startstop.thread.jamflog
3: punctuation.definition.tag.end.jamflog peripheral.thread.jamflog
- match: '(\[)(.{11})(\])'
captures:
1: punctuation.definition.tag.begin.jamflog boaring.thread.jamflog
2: boaring.thread.jamflog
3: punctuation.definition.tag.begin.jamflog boaring.thread.jamflog
# Log Message Severity
severity:
- match: '\['
scope: punctuation.definition.tag.begin.jamflog peripheral.jamflog
- match: 'DEBUG'
scope: markup.inserted.jamflog markup.info.jamflog debug.loglevel.jamflog
- match: 'INFO\s'
scope: markup.inserted.jamflog markup.info.jamflog info.loglevel.jamflog
- match: 'WARN\s'
scope: markup.changed.jamflog markup.warning.jamflog warn.loglevel.jamflog
- match: 'ERROR'
scope: markup.deleted.jamflog markup.error.jamflog error.loglevel.jamflog
- match: 'FATAL'
scope: invalid.illegal.jamflog fatal.loglevel.jamflog
- match: '\]'
scope: punctuation.definition.tag.end.jamflog peripheral.jamflog
# Java Exceptions
exception:
# This section could be improved
- match: '^([a-zA-Z\s]*)(.*Exception\:)(\s*.*)$'
captures:
1: markup.deleted.jamflog markup.error.jamflog control.jamflog
2: markup.deleted.jamflog entity.exception.jamflog
3: entity.exception.message.jamflog
# Stack Traces
stack:
# =< 10.30 it was '^(\s*)(at )(.*)(\(.*\))$'
# => 10.31 is is now: '^(\s*)(at )(.*)(\(.*\)).?.?+?(\[.*\])?$'
- match: '^(\s*)(at )(.*)(\(.*\)).?.?+?(\[.*\])?$'
captures:
1: text.jamflog
2: keyword.control.import.jamflog entity.warn.jamflog
3: support.function.jamflog entity.warn.message.jamflog
4: string.quoted.single.jamflog control.jamflog
5: support.class.jamflog library.jamflog
- match: '\.\.\.\s[0-9]+\smore'
scope: control.jamflog
# Push the builtin XML syntax
inlinexml:
- match: '(<\?xml)\s((.|\n)*)'
push: Packages/XML/XML.sublime-syntax
with_prototype:
# Pop with the typical end plist tag
- match: '(?<=</plist>)'
pop: true
# Pop at the next timestamped line if the XML is not closed correctly
- match: '^(\d{4}\-\d{2}\-\d{2}.\d{2}\:\d{2}\:\d{2}\,\d{3})'
scope: constant.numeric.jamflog timestamp.jamflog
pop: true