readLogFile function

This function reads a log file and returns the last 'lineCount' lines. If an error occurs while reading the file, it logs the error and returns undefined.

  • Parameters

    • logFilePath: string

      The path to the log file to read.

    • lineCount: number

      The number of lines to read from the end of the log file.

    Returns Promise<undefined | { line: string }[]>

    A promise that resolves to a string containing the last 'lineCount' lines of the log file, or undefined if an error occurs.