Skip to content

Commit e30d0e4

Browse files
committed
Added logging of timings
1 parent 835a2f5 commit e30d0e4

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ require (
99
github.com/pkg/errors v0.9.1
1010
github.com/stretchr/testify v1.7.0
1111
go.bug.st/json v1.15.6
12-
go.bug.st/lsp v0.0.0-20211202163946-3ad3994172a0
12+
go.bug.st/lsp v0.0.0-20220608135618-8a2f8eb9ad1b
1313
google.golang.org/grpc v1.42.0
1414
)

go.sum

+2-4
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,8 @@ go.bug.st/downloader/v2 v2.1.1 h1:nyqbUizo3E2IxCCm4YFac4FtSqqFpqWP+Aae5GCMuw4=
337337
go.bug.st/downloader/v2 v2.1.1/go.mod h1:VZW2V1iGKV8rJL2ZEGIDzzBeKowYv34AedJz13RzVII=
338338
go.bug.st/json v1.15.6 h1:pvSpotu6f5JoCbx1TnKn6asVH7o9Tg2/GKsZSVzBOsc=
339339
go.bug.st/json v1.15.6/go.mod h1:bh58F9adz5ePlNqtvbuXuXcf9k6IrDLKH6lJUsHP3TI=
340-
go.bug.st/lsp v0.0.0-20211130152916-c597b0a0439f h1:Rj7FdBdROWh9mMra/16G/5d7u/QE0Wwq487NZt+Evjg=
341-
go.bug.st/lsp v0.0.0-20211130152916-c597b0a0439f/go.mod h1:oYTh1uf5hI1teV5crrWut41Pk8vD/NqIjs4zD+No5FE=
342-
go.bug.st/lsp v0.0.0-20211202163946-3ad3994172a0 h1:/SnZ7aZ3bmfUKWbhckiK6L4mv9vyf9HgwV6X0dm+/is=
343-
go.bug.st/lsp v0.0.0-20211202163946-3ad3994172a0/go.mod h1:oYTh1uf5hI1teV5crrWut41Pk8vD/NqIjs4zD+No5FE=
340+
go.bug.st/lsp v0.0.0-20220608135618-8a2f8eb9ad1b h1:JkRunYlYDXFIgMf3BfgFrQyvHCsqkUuCGL9CUYhY3zc=
341+
go.bug.st/lsp v0.0.0-20220608135618-8a2f8eb9ad1b/go.mod h1:oYTh1uf5hI1teV5crrWut41Pk8vD/NqIjs4zD+No5FE=
344342
go.bug.st/relaxed-semver v0.0.0-20190922224835-391e10178d18 h1:F1qxtaFuewctYc/SsHRn+Q7Dtwi+yJGPgVq8YLtQz98=
345343
go.bug.st/relaxed-semver v0.0.0-20190922224835-391e10178d18/go.mod h1:Cx1VqMtEhE9pIkEyUj3LVVVPkv89dgW8aCKrRPDR/uE=
346344
go.bug.st/serial v1.3.2/go.mod h1:jDkjqASf/qSjmaOxHSHljwUQ6eHo/ZX/bxJLQqSlvZg=

ls/lsp_logger.go

+11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package ls
33
import (
44
"fmt"
55
"log"
6+
"time"
67

78
"github.com/fatih/color"
89
"go.bug.st/json"
@@ -15,6 +16,10 @@ type LSPLogger struct {
1516
ErrorColor func(format string, a ...interface{}) string
1617
}
1718

19+
func init() {
20+
log.SetFlags(log.Lmicroseconds)
21+
}
22+
1823
func (l *LSPLogger) LogOutgoingRequest(id string, method string, params json.RawMessage) {
1924
log.Print(l.HiColor("%s REQU %s %s", l.OutgoingPrefix, method, id))
2025
}
@@ -58,6 +63,12 @@ func (l *LSPLogger) LogIncomingNotification(method string, params json.RawMessag
5863
prefix: fmt.Sprintf("%s %s", spaces[:len(l.IncomingPrefix)], method),
5964
}
6065
}
66+
func (l *LSPLogger) LogIncomingDataDelay(delay time.Duration) {
67+
log.Printf("IN Elapsed: %v", delay)
68+
}
69+
func (l *LSPLogger) LogOutgoingDataDelay(delay time.Duration) {
70+
log.Printf("OUT Elapsed: %v", delay)
71+
}
6172

6273
type LSPFunctionLogger struct {
6374
colorFunc func(format string, a ...interface{}) string

0 commit comments

Comments
 (0)