zk/internal/adapter/lsp/logger.go
Mickaël Menu 50855154e2
Architecture (#27)
* Move everything under the internal package.
* Better separation between core and adapter packages, for easier unit testing.
* Simplify data models.
* Support multiple opened notebooks during runtime (useful for the LSP server).
* Proper surface API which might be exposed later as a public Go package.
2021-04-14 20:14:01 +02:00

39 lines
689 B
Go

package lsp
import (
"fmt"
"github.com/tliron/kutil/logging"
)
// glspLogger is a Logger wrapping the GLSP one.
// Can be used to change the active logger during runtime.
type glspLogger struct {
log logging.Logger
}
func newGlspLogger(log logging.Logger) *glspLogger {
return &glspLogger{log}
}
func (l *glspLogger) Printf(format string, v ...interface{}) {
l.log.Debugf("zk: "+format, v...)
}
func (l *glspLogger) Println(vs ...interface{}) {
message := "zk: "
for i, v := range vs {
if i > 0 {
message += ", "
}
message += fmt.Sprint(v)
}
l.log.Debug(message)
}
func (l *glspLogger) Err(err error) {
if err != nil {
l.log.Debugf("zk: warning: %v", err)
}
}