Skip to content

Commit 36b4f8d

Browse files
committed
Add code to log entry
Some tools generate codes, this might be useful to search for a resolution or filtering.
1 parent 5354b4e commit 36b4f8d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

edalogparser/base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
import json
33

44
class LogEntry:
5-
def __init__(self, *, severity=None, msg=None, file=None, line=None, col=None):
5+
def __init__(self, *, severity=None, msg=None, file=None, line=None, col=None, code=None):
66
self.severity = severity
77
self.msg = msg
88
self.file = file
99
self.line = line
1010
self.col = col
11+
self.code = code
1112
def as_dict(self, full=False):
1213
d = { "severity": self.severity, "msg": self.msg }
1314
if self.file is not None or full:
@@ -43,6 +44,8 @@ def as_ghaction(self):
4344
if self.col is not None:
4445
m += ",col={}".format(self.col)
4546
m += "::" + self.msg.replace('%', '%25').replace('\\n', '%0A').replace('\\r', '%0D').replace("\\'", "\'")
47+
if self.code is not None:
48+
m += " ({})".format(self.code)
4649
return m
4750

4851
class Log(list):

edalogparser/vivado.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def parse(self, log):
2020
colon = m.group(6).rfind(":")
2121
file = m.group(6)[0:colon]
2222
line = m.group(6)[colon+1:]
23-
entries.append(LogEntry(severity=severity, msg=msg, file=file, line=line))
23+
code = m.group(3)
24+
entries.append(LogEntry(severity=severity, msg=msg, file=file, line=line, code=code))
2425
return entries
2526

0 commit comments

Comments
 (0)