mirror of
https://github.com/mickael-menu/zk
synced 2024-11-03 23:15:49 +00:00
50855154e2
* 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.
39 lines
689 B
Go
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)
|
|
}
|
|
}
|