1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

Add debug logging to golang side

This commit is contained in:
Ryan Dahl 2018-05-23 13:23:29 -04:00
parent be4883722f
commit 644e7fa065
2 changed files with 10 additions and 0 deletions

View file

@ -5,6 +5,7 @@ import (
"fmt"
"github.com/golang/protobuf/proto"
"github.com/ry/v8worker2"
"io/ioutil"
"log"
"os"
"runtime/pprof"
@ -34,6 +35,11 @@ func main() {
}
args = v8worker2.SetFlags(args)
// Unless the debug flag is specified, discard logs.
if !*flagDebug {
log.SetOutput(ioutil.Discard)
}
// Maybe start Golang CPU profiler.
// Use --prof for profiling JS.
if *flagGoProf != "" {

4
os.go
View file

@ -3,6 +3,7 @@ package main
import (
"github.com/golang/protobuf/proto"
"io/ioutil"
"log"
"net/url"
"os"
"path"
@ -35,6 +36,9 @@ func InitOS() {
func ResolveModule(moduleSpecifier string, containingFile string) (
moduleName string, filename string, err error) {
log.Printf("ResolveModule %s %s", moduleSpecifier, containingFile)
moduleUrl, err := url.Parse(moduleSpecifier)
if err != nil {
return