src/UCRM/Plugins/Log.php
public static function lines(int $tail = 0): ?array
    {
        $log_file =
            Plugin::dataPath().
            DIRECTORY_SEPARATOR."plugin.log";

        if(!file_exists($log_file))
            throw new RequiredFileNotFoundException(
                "A plugin.log file could not be found at '".$log_file."'.");

        $lines = preg_split("/[\r\n|\r|\n]+/", file_get_contents($log_file));

        // Remove the final empty line...
        if($lines[count($lines) - 1] === "")
            unset($lines[count($lines) - 1]);

        if($tail < 0)
            return null;

        if($tail === 0)
            return $lines;

        return array_slice($lines, -$tail, $tail);
    }
public static function lines(int $tail = 0): ?array
    {
        $log_file =
            Plugin::dataPath().
            DIRECTORY_SEPARATOR."plugin.log";

        if(!file_exists($log_file))
            throw new RequiredFileNotFoundException(
                "A plugin.log file could not be found at '".$log_file."'.");

        $lines = preg_split("/[\r\n|\r|\n]+/", file_get_contents($log_file));

        // Remove the final empty line...
        if($lines[count($lines) - 1] === "")
            unset($lines[count($lines) - 1]);

        if($tail < 0)
            return null;

        if($tail === 0)
            return $lines;

        return array_slice($lines, -$tail, $tail);
    }
public static function lines ( int $ tail = 0 ) : ? array { $ log_file = Plugin :: dataPath ( ) . DIRECTORY_SEPARATOR . "plugin.log" ; if ( ! file_exists ( $ log_file ) ) throw new RequiredFileNotFoundException ( "A plugin.log file could not be found at '" . $ log_file . "'." ) ; $ lines = preg_split ( "/[\r\n|\r|\n]+/" , file_get_contents ( $ log_file ) ) ; // Remove the final empty line... if ( $ lines [ count ( $ lines ) - 1 ] === "" ) unset ( $ lines [ count ( $ lines ) - 1 ] ) ; if ( $ tail < 0 ) return null ; if ( $ tail === 0 ) return $ lines ; return array_slice ( $ lines , - $ tail , $ tail ) ; }
Reads the specified number of trailing lines from this Plugin's log file.

@param int $tail The number of lines at the end of the file for which to return. 0 = All Lines (default)
@return array|null An array of the requested lines.
@throws RequiredFileNotFoundException Thrown when a plugin.log file cannot be found.
Reads the specified number of trailing lines from this Plugin s log file .