Ejemplo n.º 1
0
function flushLog()
{
    // Declare global variables
    global $bInitDone, $arrLog, $nArrLog, $fLog, $strCSV;
    if ($bInitDone and 0 < $nArrLog) {
        // Open log-file for append if not already opened
        openLogFile();
        // Write log
        foreach ($arrLog as $arrLine) {
            $arrLine[1] = trim($arrLine[1]);
            $arrLine[2] = trim($arrLine[2]);
            $strLine = implode($strCSV, $arrLine) . PHP_EOL;
            fwrite($fLog, $strLine);
        }
        $arrLog = array();
        $nArrLog = 0;
    }
}
Ejemplo n.º 2
0
/**
 * Write a log message
 *
 * All arguments treated as substrings that are concatenated and
 * printed to to the log.
 *
 * @return void
 */
function logMessage()
{
    // Yuck, globals.  W/e this is just a simple script
    global $lfh;
    $msg = implode("", func_get_args());
    # Add trailing newline to log message if there is not already one
    if (!preg_match("/\n\$/s", $msg)) {
        $msg .= "\n";
    }
    # Open the log if needed, then write the message to the log
    if (openLogFile()) {
        if (!fwrite($lfh, $msg)) {
            warn("Error writing to log file");
        }
    }
}
Ejemplo n.º 3
0
} else {
    $filenameError .= '_' . $arrRunParameter['error_postfix'];
}
// Finish log_ext
if ('' == $arrRunParameter['log_ext']) {
    $filenameLog .= '.log';
    $filenameError .= '.log';
} else {
    $filenameLog .= '.' . $arrRunParameter['log_ext'];
    $filenameError .= '.' . $arrRunParameter['log_ext'];
}
// Log log-filename
$strDescription = '- log filename [' . $filenameLog . ']' . PHP_EOL;
$strLine = '';
logLog(0, $strDescription, $strLine, 2);
// Log error-filename
$strDescription = '- error filename [' . $filenameError . ']' . PHP_EOL;
$strLine = '';
logLog(0, $strDescription, $strLine, 2);
if ($bLogFile) {
    // Open log-file
    openLogFile();
}
# END 14.4 - Get log filename #
$bInitDone = true;
// END inc-section
if ($bLogInc) {
    $strDescription = 'END php include <<< ' . $strIncPhpScript . ' <<<' . PHP_EOL;
    $strLine = '';
    logLog(0, $strDescription, $strLine, 2);
}