debug

package
v0.9.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 8 Imported by: 21 modules, 119 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package debug provides functions for debug logging.

Index

Constants

This section is empty.

Variables

View Source
var Enable bool = FlagSet("debug")

Enable controls whether debug logging is enabled. It is disabled by default.

View Source
var Flags = os.Getenv("OPC_DEBUG")

Flags contains the debug flags set by OPC_DEBUG.

  • codec : print detailed debugging information when encoding/decoding
View Source
var Logger = log.New(os.Stderr, "debug: ", 0)

Logger logs the debug messages when debug logging is enabled.

It defaults to writing to os.Stderr but, since it is an exported *log.Logger, applications can redirect it at runtime with Logger.SetOutput(w) (or replace it entirely, e.g. Logger = log.New(...)), for example to route opcua debug logs through the app's own logging framework. NewPrefixLogger honors the same destination since it derives its writer from Logger.Writer().

Functions

func FlagSet

func FlagSet(name string) bool

FlagSet returns true if the OPC_DEBUG environment variable contains the given flag.

func NewPrefixLogger added in v0.2.0

func NewPrefixLogger(format string, args ...interface{}) *log.Logger

PrefixLogger returns a new debug logger when debug logging is enabled. Otherwise, a discarding logger is returned.

func Printf

func Printf(format string, args ...interface{})

Printf logs the message with Logger.Printf() when debug logging is enabled.

func ToJSON added in v0.2.0

func ToJSON(v interface{}) string

ToJSON returns the JSON representation of v when debug logging is enabled.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL