@hiero-ledger/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

    • Creates a new Logger instance.

      Parameters

      • options: LoggerOptions

        the logger configuration options

      Returns Logger

    • Creates a new Logger instance.

      Parameters

      • level: LogLevel

        the log level

      • OptionallogFile: string

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

      • Optionalsync: boolean

        perform writes synchronously (similar to console.log)

      • Optionalfsync: boolean

        perform a fsyncSync every time a write is completed

      • Optionalmkdir: boolean

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

      • OptionalminLength: number

        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)