I'm trying to create sublime syntax highlighting for android logs. Logs look something like this:
`2024-01-23 04:01:30,485 [pool-1-thread-39] DEBUG RootDo cmd=cat /sys/devices/soc0/soc/`
`2024-01-23 04:01:30,801 [pool-1-thread-5] INFO AssetServerCommHandler send to link data:{"commId":"¸1","data":[{"classtype":"11","databoxid":1,"id":"fax","type":"1"}]`
`2024-01-23 04:01:33,332 [pool-1-thread-5] WARN AssetServerCommHandler res={"resstatus":"NORMAL","statuses":["GET_DEPLOY"],"dataerrorids":[],"data":[{"classtype":"7","type":"7","ocode":null,"pcode":"CTB","regnum":"1"}],"load":1.0}`
`2024-01-23 04:01:33,334 [start_DCPServer] INFO DCPShareUI onDrop /127.0.0.1`
These logs also include errors, than are in same format as the logs above, but they include stack trace under them.
2024-01-23 04:04:39,265 [dab] ERROR WebSocketConnector-asset onFailure
javax.net.ssl.SSLException: Read error: ssl=1: I/O error during system call, Software caused connection abort
at com.android.org.conscrypt.NativeCrypto.SSL_read(Native Method)
at com.android.org.conscrypt.NativeSsl.read(NativeSsl.java:399)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket$SSLInputStream.read(ConscryptFileDescriptorSocket.java:546)
at okio.InputStreamSource.read(JvmOkio.kt:94)
at java.lang.Thread.run(Thread.java:764)
My problem is that with following syntax the first line after the error part does not register properly. (Time and thread are counted as ERROR, the rest of the line is nothing) The problem
%YAML 1.2
---
name: Log
file_extensions:
- log
scope: source.log
contexts:
main:
- match: '\b(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3} \[.*?\] ERROR .+)$'
captures:
1: keyword.log_level.ERROR
push:
- meta_scope: stack_trace
- match: '^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3} \[.*?\] (?!ERROR)'
pop: true
- match: '\b(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3} \[.*?\] WARN .+)$'
captures:
1: keyword.log_level.WARN
- match: '\b(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3} \[.*?\] DEBUG .+)$'
captures:
1: keyword.log_level.DEBUG
- match: '\b(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3} \[.*?\] INFO .+)$'
captures:
1: keyword.log_level.INFO