Put writer log under a flag.

This commit is contained in:
Qi Xiao 2016-02-22 23:10:25 +01:00
parent 60ea1ffb35
commit 619f274f61

View File

@ -18,6 +18,8 @@ const (
navigationListingMinWidthForPadding = 5 navigationListingMinWidthForPadding = 5
) )
var logWriterDetail = false
// cell is an indivisible unit on the screen. It is not necessarily 1 column // cell is an indivisible unit on the screen. It is not necessarily 1 column
// wide. // wide.
type cell struct { type cell struct {
@ -247,7 +249,9 @@ func (w *writer) commitBuffer(bufNoti, buf *buffer, fullRefresh bool) error {
} }
if bufNoti != nil { if bufNoti != nil {
// Logger.Printf("going to write %d lines of notifications", len(bufNoti.cells)) if logWriterDetail {
Logger.Printf("going to write %d lines of notifications", len(bufNoti.cells))
}
// Write notifications // Write notifications
for _, line := range bufNoti.cells { for _, line := range bufNoti.cells {
@ -260,7 +264,9 @@ func (w *writer) commitBuffer(bufNoti, buf *buffer, fullRefresh bool) error {
} }
} }
// Logger.Printf("going to write %d lines, oldBuf had %d", len(buf.cells), len(w.oldBuf.cells)) if logWriterDetail {
Logger.Printf("going to write %d lines, oldBuf had %d", len(buf.cells), len(w.oldBuf.cells))
}
for i, line := range buf.cells { for i, line := range buf.cells {
if i > 0 { if i > 0 {
@ -304,7 +310,9 @@ func (w *writer) commitBuffer(bufNoti, buf *buffer, fullRefresh bool) error {
cursor := buf.cursor() cursor := buf.cursor()
bytesBuf.Write(deltaPos(cursor, buf.dot)) bytesBuf.Write(deltaPos(cursor, buf.dot))
Logger.Printf("going to write %q", bytesBuf.String()) if logWriterDetail {
Logger.Printf("going to write %q", bytesBuf.String())
}
fd := int(w.file.Fd()) fd := int(w.file.Fd())
if nonblock, _ := sys.GetNonblock(fd); nonblock { if nonblock, _ := sys.GetNonblock(fd); nonblock {
@ -620,8 +628,10 @@ tokens:
} }
} }
Logger.Printf("bufLine %d, bufMode %d, bufTips %d, bufListing %d", if logWriterDetail {
lines(bufLine), lines(bufMode), lines(bufTips), lines(bufListing)) Logger.Printf("bufLine %d, bufMode %d, bufTips %d, bufListing %d",
lines(bufLine), lines(bufMode), lines(bufTips), lines(bufListing))
}
// Combine buffers (reusing bufLine) // Combine buffers (reusing bufLine)
buf = bufLine buf = bufLine