hammerspoon2-docs
    Preparing search index...

    Function consoleHistory

    • Get the messages currently in the Hammerspoon Console, oldest first. This is the same history the Console window shows, so it's limited by the "Console history length" setting (which applies to each level separately), and hs.clearConsole() empties it.

      Parameters

      • Optionaloptions:
            | {
                minimumLevel?: | "garbage"
                | "debug"
                | "info"
                | "warning"
                | "error"
                | "javascript";
                search?: string;
                since?: number;
            }
            | null

        Which messages to get

        • {
              minimumLevel?:
                  | "garbage"
                  | "debug"
                  | "info"
                  | "warning"
                  | "error"
                  | "javascript";
              search?: string;
              since?: number;
          }
          • OptionalminimumLevel?: "garbage" | "debug" | "info" | "warning" | "error" | "javascript"

            Only get messages at this level or above, e.g. "warning" for warnings and errors (and "javascript" messages, which count as the highest level). Defaults to every level

          • Optionalsearch?: string

            Only get messages that contain this text, ignoring case

          • Optionalsince?: number

            Only get messages whose sequence is higher than this

        • null

      Returns {
          date: Date;
          level: "garbage" | "debug" | "info" | "warning" | "error" | "javascript";
          message: string;
          sequence: number;
      }[]

      The matching messages, oldest first

      • date: Date

        When the message was logged

      • level: "garbage" | "debug" | "info" | "warning" | "error" | "javascript"

        The message's level, where "javascript" is for console.log() and friends

      • message: string

        The message's text

      • sequence: number

        A number that's higher for each newer message. Pass the last one you've seen as since to get only the messages logged after it

      Messages reach the Console asynchronously, so one logged moments ago, including

      Throws an Error on failure; wrap calls in try/catch to handle it.