Commit dba815c4 authored by haemmer's avatar haemmer
Browse files

Connection to system logger now is opened only when it is needed

parent 390ae84c
......@@ -9,9 +9,6 @@ Web site: https://www.switch.ch/aai/support/tools/wayf/
******************************************************************************
*/
// Init connection to system logger
openlog("SWITCHwayf", LOG_ODELAY, LOG_USER);
/*------------------------------------------------*/
// Load general configuration and template file
/*------------------------------------------------*/
......
......@@ -755,10 +755,19 @@ function logAccessEntry($protocol, $type, $sp, $idp, $return){
}
/******************************************************************************/
// Init connection to system logger
function initLogger(){
openlog("SWITCHwayf", LOG_NDELAY, LOG_USER);
}
/******************************************************************************/
// Logs an info message
function logInfo($infoMsg){
global $developmentMode;
initLogger();
syslog(LOG_INFO, $infoMsg);
if ($developmentMode && isRun){
......@@ -771,6 +780,8 @@ function logInfo($infoMsg){
function logWarning($warnMsg){
global $developmentMode;
initLogger();
syslog(LOG_WARNING, $warnMsg);
if ($developmentMode && isRunViaCLI()){
......@@ -783,6 +794,8 @@ function logWarning($warnMsg){
function logError($errorMsg){
global $developmentMode;
initLogger();
syslog(LOG_ERR, $errorMsg);
if ($developmentMode){
......
......@@ -21,9 +21,6 @@ require_once('config.php');
if(isRunViaCLI()){
// Run in cli mode.
// Init log file
openlog("SWITCHwayf.readMetadata.php", LOG_ODELAY, LOG_USER);
// Set default config options
initConfigOptions();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment