Skip to content
This repository was archived by the owner on May 11, 2020. It is now read-only.

Commit d73568a

Browse files
vibhavpsbinet
authored andcommitted
disasm: Add private var "logging".
1 parent 0c3145f commit d73568a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

disasm/disasm.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,10 @@ func Disassemble(fn wasm.Function, module *wasm.Module) (*Disassembly, error) {
459459
curIndex++
460460
}
461461

462-
for _, instr := range disas.Code {
463-
logger.Printf("%v %v", instr.Op.Name, instr.NewStack)
462+
if logging {
463+
for _, instr := range disas.Code {
464+
logger.Printf("%v %v", instr.Op.Name, instr.NewStack)
465+
}
464466
}
465467

466468
return disas, nil

disasm/log.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ import (
1010
"os"
1111
)
1212

13-
var logger *log.Logger
13+
var (
14+
logger *log.Logger
15+
logging bool
16+
)
1417

1518
func SetDebugMode(l bool) {
1619
w := ioutil.Discard
20+
logging = l
1721

1822
if l {
1923
w = os.Stderr

0 commit comments

Comments
 (0)