Skip to content

Commit

Permalink
Logging enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
pgundlach committed Jan 19, 2024
1 parent 195366c commit 2ad65a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion core/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func dispatch(xd *xtsDocument, layoutelement *goxml.Element, data *xpath.Parser)
for _, cld := range layoutelement.Children() {
if elt, ok := cld.(*goxml.Element); ok {
if f, ok := dispatchTable[elt.Name]; ok {
slog.Debug(fmt.Sprintf("Call %s (line %d)", elt.Name, elt.Line))
slog.Debug("Command", "cmd", elt.Name, "line", elt.Line)
seq, err := f(xd, elt)
if err != nil {
return nil, err
Expand Down
16 changes: 6 additions & 10 deletions core/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,14 @@ func clearPage(xd *xtsDocument) {
}
cp := xd.currentPage
if cp.atPageShipout != nil {
slog.Debug("Call AtPageShipout")
cp.atPageShipout()
}
xd.currentPage.bagPage.Shipout()
xd.currentPage = nil
}

func newPage(xd *xtsDocument) (*page, func(), error) {
slog.Debug("newPage")
slog.Debug("New page")
xd.currentPagenumber++
g := newGrid(xd)
pt, err := xd.detectPagetype("")
Expand Down Expand Up @@ -141,7 +140,10 @@ func newPage(xd *xtsDocument) (*page, func(), error) {
slog.Debug(fmt.Sprintf("Call %s (line %d)", t.Name, t.Line))
f = func() { dispatch(xd, t, xd.data) }
case "AtPageShipout":
pg.atPageShipout = func() { dispatch(xd, t, xd.data) }
pg.atPageShipout = func() {
slog.Debug(fmt.Sprintf("Call %s (line %d)", t.Name, t.Line))
dispatch(xd, t, xd.data)
}
case "PositioningArea":
attValues := &struct {
Name string `sdxml:"mustexist"`
Expand Down Expand Up @@ -209,8 +211,6 @@ func (p *page) String() string {
}

func (xd *xtsDocument) OutputAt(vl *node.VList, col coord, row coord, allocate bool, area *area, what string, halign frontend.HorizontalAlignment) error {
areatext := ""

var currentGroup *group
if currentGroup = xd.currentGroup; currentGroup != nil {
if area.name != pageAreaName {
Expand All @@ -220,11 +220,7 @@ func (xd *xtsDocument) OutputAt(vl *node.VList, col coord, row coord, allocate b
currentGroup.contents = vl
}
} else {
// for debugging
if area.name != pageAreaName {
areatext = fmt.Sprintf("%s [%d]: ", area.name, 1)
}
slog.Info(fmt.Sprintf("PlaceObject: output %s at (%s%d,%d)", what, areatext, col, row))
slog.Info("PlaceObject", "obj", what, "col", col, "row", row, "area", area.name)

shiftRight := bag.ScaledPoint(0)
if halign == frontend.HAlignRight {
Expand Down

0 comments on commit 2ad65a3

Please sign in to comment.