• Version 7.21.1
  • Published
  • 98.9 kB
  • 3 dependencies
  • BSD-3-Clause license


npm i roarr
yarn add roarr
pnpm add roarr


JSON logger for Node.js and browser.



variable logLevels

const logLevels: {
debug: number;
error: number;
fatal: number;
info: number;
trace: number;
warn: number;

    variable Roarr

    const Roarr: Logger<JsonObject>;

      variable ROARR

      const ROARR: RoarrGlobalState;


        function getLogLevelName

        getLogLevelName: (numericLogLevel: number) => LogLevelName;

          Type Aliases

          type Logger

          type Logger<Z = MessageContext> = LogMethod<Z> & {
          adopt: <T>(
          routine: () => T,
          context?: MessageContext | TransformMessageFunction<MessageContext>
          ) => Promise<T>;
          child: Child<Z>;
          debug: LogMethod<Z>;
          debugOnce: LogMethod<Z>;
          error: LogMethod<Z>;
          errorOnce: LogMethod<Z>;
          fatal: LogMethod<Z>;
          fatalOnce: LogMethod<Z>;
          getContext: () => MessageContext;
          info: LogMethod<Z>;
          infoOnce: LogMethod<Z>;
          trace: LogMethod<Z>;
          traceOnce: LogMethod<Z>;
          warn: LogMethod<Z>;
          warnOnce: LogMethod<Z>;

            type LogLevelName

            type LogLevelName = 'debug' | 'error' | 'fatal' | 'info' | 'trace' | 'warn';

              type LogWriter

              type LogWriter = (message: string) => void;

                type Message

                type Message<T = MessageContext> = {
                readonly context: T;
                readonly message: string;
                readonly sequence: string;
                readonly time: number;
                readonly version: string;

                  type MessageContext

                  type MessageContext<T = {}> = JsonObject & T;

                    type MessageEventHandler

                    type MessageEventHandler = (message: Message<MessageContext>) => void;

                      type MessageSerializer

                      type MessageSerializer = (message: Message<MessageContext>) => string;

                        type RoarrGlobalState

                        type RoarrGlobalState = {
                        asyncLocalStorage?: AsyncLocalStorage<AsyncLocalContext>;
                        onceLog: Set<string>;
                        sequence: number;
                        serializeMessage?: MessageSerializer;
                        versions: readonly string[];
                        write: LogWriter;

                          type TransformMessageFunction

                          type TransformMessageFunction<T> = (message: Message<T>) => Message<MessageContext>;


                            namespace *.json

                            module '*.json' {}

                              variable version

                              const version: string;

                                Package Files (5)

                                Dependencies (3)

                                Dev Dependencies (18)

                                Peer Dependencies (0)

                                No peer dependencies.


                                To add a badge like this badgeto your package's README, use the codes available below.

                                You may also use to create a custom badge linking to

                                • Markdown
                                • HTML
                                  <a href=""><img src="" alt=""></a>