Switch github.com/kirsle/golog to git.kirsle.net/go/log

* New logger module supports js/wasm build by skipping the dependency on
  ssh/terminal (which detected interactive consoles, not applicable to
  JS). In WASM the logs go to the browser console and ANSI color codes
  not needed.
This commit is contained in:
Noah 2019-12-22 18:34:31 -08:00
parent ea0b41a781
commit d658359240
4 changed files with 13 additions and 21 deletions

View File

@ -6,14 +6,14 @@ import (
"strings"
"time"
"git.kirsle.net/go/render"
"git.kirsle.net/go/render/event"
"git.kirsle.net/apps/doodle/pkg/balance"
"git.kirsle.net/apps/doodle/pkg/branding"
"git.kirsle.net/apps/doodle/pkg/enum"
"git.kirsle.net/apps/doodle/pkg/log"
"git.kirsle.net/apps/doodle/pkg/shmem"
"github.com/kirsle/golog"
golog "git.kirsle.net/go/log"
"git.kirsle.net/go/render"
"git.kirsle.net/go/render/event"
)
const (

View File

@ -1,8 +0,0 @@
package level_test
import "github.com/kirsle/golog"
func init() {
log := golog.GetLogger("doodle")
log.Config.Level = golog.ErrorLevel
}

View File

@ -3,24 +3,24 @@ package log
import (
"runtime"
"github.com/kirsle/golog"
"git.kirsle.net/go/log"
)
// Logger is the public golog.Logger object.
var Logger *golog.Logger
// Logger is the public log.Logger object.
var Logger *log.Logger
func init() {
Logger = golog.GetLogger("doodle")
Logger.Configure(&golog.Config{
Level: golog.InfoLevel,
Theme: golog.DarkTheme,
Colors: golog.ExtendedColor,
Logger = log.GetLogger("doodle")
Logger.Configure(&log.Config{
Level: log.InfoLevel,
Theme: log.DarkTheme,
Colors: log.ExtendedColor,
TimeFormat: "2006-01-02 15:04:05.000000",
})
// TODO: Disable ANSI colors in logs on Windows.
if runtime.GOOS == "windows" {
Logger.Config.Colors = golog.NoColor
Logger.Config.Colors = log.NoColor
}
}

View File

@ -35,7 +35,7 @@ serif in case of any problems.
## Known Bugs and Limitations
* github.com/kirsle/golog
* git.kirsle.net/go/log
* The detection of an interactive terminal is broken in WASM.
* `terminal.IsTerminal(int(os.Stdout.Fd()))`
* As a workaround, comment it out and hardcode to `false`