Interface ILogger

interface ILogger {
    debug: ((message: string, options?: LogOptions) => Promise<void>);
    error: ((message: string, options?: LogOptions) => Promise<void>);
    info: ((message: string, options?: LogOptions) => Promise<void>);
    trace: ((message: string, options?: LogOptions) => Promise<void>);
    warn: ((message: string, options?: LogOptions) => Promise<void>);
}

Properties

debug: ((message: string, options?: LogOptions) => Promise<void>)

Type declaration

    • (message, options?): Promise<void>
    • Logs a message at the debug level.

      Parameters

      • message: string

        Examples

        import { debug } from '@tauri-apps/plugin-log';

        const pos = { x: 3.234, y: -1.223 };

        debug(`New position: x: {pos.x}, y: {pos.y}`);
      • Optionaloptions: LogOptions

      Returns Promise<void>

error: ((message: string, options?: LogOptions) => Promise<void>)

Type declaration

    • (message, options?): Promise<void>
    • Logs a message at the error level.

      Parameters

      • message: string

        Examples

        import { error } from '@tauri-apps/plugin-log';

        const err_info = "No connection";
        const port = 22;

        error(`Error: ${err_info} on port ${port}`);
      • Optionaloptions: LogOptions

      Returns Promise<void>

info: ((message: string, options?: LogOptions) => Promise<void>)

Type declaration

    • (message, options?): Promise<void>
    • Logs a message at the info level.

      Parameters

      • message: string

        Examples

        import { info } from '@tauri-apps/plugin-log';

        const conn_info = { port: 40, speed: 3.20 };

        info(`Connected to port {conn_info.port} at {conn_info.speed} Mb/s`);
      • Optionaloptions: LogOptions

      Returns Promise<void>

trace: ((message: string, options?: LogOptions) => Promise<void>)

Type declaration

    • (message, options?): Promise<void>
    • Logs a message at the trace level.

      Parameters

      • message: string

        Examples

        import { trace } from '@tauri-apps/plugin-log';

        let pos = { x: 3.234, y: -1.223 };

        trace(`Position is: x: {pos.x}, y: {pos.y}`);
      • Optionaloptions: LogOptions

      Returns Promise<void>

warn: ((message: string, options?: LogOptions) => Promise<void>)

Type declaration

    • (message, options?): Promise<void>
    • Logs a message at the warn level.

      Parameters

      • message: string

        Examples

        import { warn } from '@tauri-apps/plugin-log';

        const warn_description = "Invalid Input";

        warn(`Warning! {warn_description}!`);
      • Optionaloptions: LogOptions

      Returns Promise<void>