@hashgraph/sdk
    Preparing search index...

    Class Logger

    A Logger class for logging messages in the Hiero JavaScript SDK. This class provides a flexible logging mechanism that can log messages to various outputs, including the console and log files. It supports different log levels (e.g., trace, debug, info, warn, error, fatal) and allows for configuration of logging behavior, such as synchronous writes and file management.

    The Logger can be initialized with a specific log level, a log file path, and options for synchronous writes and file synchronization. It also provides methods to change the logging level and to enable or disable silent mode, which suppresses all log messages.

    Index

    Constructors

    • Parameters

      • level: LogLevel
      • logFile: string = ""

        the file to log to, if empty, logs to console

      • sync: boolean = true

        perform writes synchronously (similar to console.log)

      • fsync: boolean = true

        perform a fsyncSync every time a write is completed

      • mkdir: boolean = true

        ensure directory for dest file exists when true (default false)

      • minLength: number = 0

        the minimum length of the internal buffer that is required to be full before flushing

      Returns Logger

    Accessors

    • get levels(): { [level: number]: string }

      Get logging level

      Returns { [level: number]: string }

    Methods

    • Set silent mode on/off

      Parameters

      • silent: boolean

      Returns Logger

      If set to true, the logger will not display any log messages

      • This can also be achieved by calling .setLevel(LogLevel.Silent)