import type { Envelope, Metadata } from '@devvit/protos';
import type { Namespace } from '@devvit/shared-types/Namespace.js';
import type { EnvelopeDispatcher } from '../../common/envelope/dispatcher/EnvelopeDispatcher.js';
/**
 * Log categories.
 *
 * This enum is to encourage consistent tagging but any string may be used. Keep
 * this enum up-to-date with what's needed.
 */
export declare const SystemLogTag: Readonly<{
    /** A script lifecycle event such as loaded or unloaded. */
    ScriptLifecycle: "ScriptLifecycle";
    /**
     * A script threw an unhandled error when processing a request or response.
     */
    ScriptMessageError: "ScriptMessageError";
    /**
     * A log recorded by Compute. This may occur in any environment (web, Node.js,
     * worker, Go, etc). All SystemLog-recorded logs are expected to have this
     * tag.
     */
    System: "System";
}>;
export type SystemLogTag = (typeof SystemLogTag)[keyof typeof SystemLogTag];
/**
 * A structured logger for Compute system logs.
 *
 * This logger may be inert until bound.
 *
 * All logs published are tagged with "System" so they can be distinguished from
 * user logs and include invocation time. System logs may be recorded in any
 * environment (web, server, worker). The SystemLogger supports tagging and
 * routing to the a single logging plugin in all environments whereas the
 * Console API doesn't.
 *
 * All logs are asynchronous and should be awaited whenever practical.
 *
 * Users should always use the Console API whenever possible or request a Logger
 * plugin client with the Devvit API if tags or timestamp is needed.
 *
 * The default timestamp for all APIs is invocation time.
 */
export type SystemLogger = {
    /**
     * Bind the logger client to the dispatcher and route logs to the logger
     * plugin in namespace. Namespace may match or differ from dispatcher.
     *
     * EnvelopeDispatchers are normally what expose a bind method, but in this
     * case, a SystemLogger may generate an EnvelopeRecipient out of thin air,
     * bind it, and wrap all the traffic to and from it. This is because a runtime
     * isn't available in workers, only a dispatcher, so a plugin cannot be
     * provided.
     */
    bind(dispatcher: EnvelopeDispatcher, namespace?: Readonly<Namespace>): void;
    /**
     * Errors should always be reported as long as they do not contain sensitive
     * data.
     */
    error(err: unknown, metadata: Readonly<Metadata>, tags?: readonly SystemLogTag[]): Promise<void>;
    error(message: string, metadata: Readonly<Metadata>, tags?: readonly SystemLogTag[]): Promise<void>;
    /**
     * A notable event or historical record for analytics and security. These logs
     * are not usually reviewed by devs.
     */
    event(type: string, labels?: Readonly<{
        [key: string]: string;
    }>, data?: Readonly<{
        [key: string]: string;
    }>, metadata?: Readonly<Metadata>): Promise<void>;
    /**
     * Informational logs should be used to mark significant non-erroneous events.
     * Little information is significant.
     *
     * These logs are enabled by default in development builds but may be
     * disabled in production.
     */
    info(message: string, metadata: Readonly<Metadata>, tags?: readonly SystemLogTag[]): Promise<void>;
    /**
     * Verbose message logs should occur at the ingress and egress of a script and
     * are used for highly detailed tracing only.
     */
    messageError(envelope: Readonly<Envelope>, error: unknown): Promise<void>;
    /** Release the logger client. */
    unbind(dispatcher: EnvelopeDispatcher): void;
    /**
     * Verbose logs are useful for tracing but usually a hindrance for others not
     * working where the log is placed. Keep our logs clean and add with care.
     * These logs are disabled by default in all environments but can be enabled.
     */
    verbose(message: string, metadata: Readonly<Metadata>, tags?: readonly SystemLogTag[]): Promise<void>;
    /**
     * Warnings should be reported as long as they do not contain sensitive data.
     *
     * These logs are always enabled.
     */
    warn(message: string, metadata: Readonly<Metadata>, tags?: readonly SystemLogTag[]): Promise<void>;
};
/** A do-nothing SystemLogger. */
export declare class VoidSystemLogger implements SystemLogger {
    bind: () => void;
    debug: () => Promise<void>;
    error: () => Promise<void>;
    event: () => Promise<void>;
    info: () => Promise<void>;
    messageError: () => Promise<void>;
    unbind: () => Promise<void>;
    verbose: () => Promise<void>;
    warn: () => Promise<void>;
}
/** A SystemLogger facade over the conventional logger plugin service API. */
export declare class DefaultSystemLogger implements SystemLogger {
    #private;
    constructor(...tags: readonly SystemLogTag[]);
    bind(dispatcher: EnvelopeDispatcher, namespace?: Readonly<Namespace>): void;
    error(err: unknown, metadata: Readonly<Metadata>, tags?: readonly SystemLogTag[]): Promise<void>;
    error(message: string, metadata: Readonly<Metadata>, tags?: readonly SystemLogTag[]): Promise<void>;
    event(type: string, labels?: Readonly<{
        [key: string]: string;
    }> | undefined, data?: Readonly<{
        [key: string]: string;
    }> | undefined, metadata?: Readonly<Metadata> | undefined): Promise<void>;
    info(message: string, metadata: Readonly<Metadata>, tags?: readonly SystemLogTag[]): Promise<void>;
    messageError(envelope: Readonly<Envelope>, error: unknown): Promise<void>;
    unbind(dispatcher: EnvelopeDispatcher): Promise<void>;
    verbose(message: string, metadata: Readonly<Metadata>, tags?: readonly SystemLogTag[]): Promise<void>;
    warn(message: string, metadata: Readonly<Metadata>, tags?: readonly SystemLogTag[]): Promise<void>;
}
//# sourceMappingURL=SystemLogger.d.ts.map