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" "strings"
"time" "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/balance"
"git.kirsle.net/apps/doodle/pkg/branding" "git.kirsle.net/apps/doodle/pkg/branding"
"git.kirsle.net/apps/doodle/pkg/enum" "git.kirsle.net/apps/doodle/pkg/enum"
"git.kirsle.net/apps/doodle/pkg/log" "git.kirsle.net/apps/doodle/pkg/log"
"git.kirsle.net/apps/doodle/pkg/shmem" "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 ( 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 ( import (
"runtime" "runtime"
"github.com/kirsle/golog" "git.kirsle.net/go/log"
) )
// Logger is the public golog.Logger object. // Logger is the public log.Logger object.
var Logger *golog.Logger var Logger *log.Logger
func init() { func init() {
Logger = golog.GetLogger("doodle") Logger = log.GetLogger("doodle")
Logger.Configure(&golog.Config{ Logger.Configure(&log.Config{
Level: golog.InfoLevel, Level: log.InfoLevel,
Theme: golog.DarkTheme, Theme: log.DarkTheme,
Colors: golog.ExtendedColor, Colors: log.ExtendedColor,
TimeFormat: "2006-01-02 15:04:05.000000", TimeFormat: "2006-01-02 15:04:05.000000",
}) })
// TODO: Disable ANSI colors in logs on Windows. // TODO: Disable ANSI colors in logs on Windows.
if runtime.GOOS == "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 ## Known Bugs and Limitations
* github.com/kirsle/golog * git.kirsle.net/go/log
* The detection of an interactive terminal is broken in WASM. * The detection of an interactive terminal is broken in WASM.
* `terminal.IsTerminal(int(os.Stdout.Fd()))` * `terminal.IsTerminal(int(os.Stdout.Fd()))`
* As a workaround, comment it out and hardcode to `false` * As a workaround, comment it out and hardcode to `false`