• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2023 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5//go:build debugtrace
6
7package inlheur
8
9import (
10	"os"
11	"strconv"
12)
13
14var debugTrace = 0
15
16func enableDebugTrace(x int) {
17	debugTrace = x
18}
19
20func enableDebugTraceIfEnv() {
21	v := os.Getenv("DEBUG_TRACE_INLHEUR")
22	if v == "" {
23		return
24	}
25	if v[0] == '*' {
26		if !UnitTesting() {
27			return
28		}
29		v = v[1:]
30	}
31	i, err := strconv.Atoi(v)
32	if err != nil {
33		return
34	}
35	debugTrace = i
36}
37
38func disableDebugTrace() {
39	debugTrace = 0
40}
41