Logs a system message
@TODO relegate this function to the log class

@param type $msgString
@param type $console
@param type $type
@param type $typekey
@param type $title
@param type $logFile
@return type
976144
public static function _($string, $title = "Console Log", $type = "info", $typekey = "", $console = TRUE, $logFile = TRUE)
    {

        $output = \Library\Output::getInstance();
        //Remember to set the file;
        self::$file = Config::getParam("logfile", "system.log");

        //$output->addToPosition("do:console", $msgString , '', '', FALSE);

        //If isset this $log;
        $logkey = md5(strval($string . $console . $type . $logFile));

        if (!isset(self::$log[$logkey])) {
            self::$log[$logkey] = array(
                "title" => $title,
                "string" => $string,
                "type" => strtolower($type),
                "key" => $logkey,
                "time" => date("Y-m-d H:i:s"),
                "_toconsole" => $console,
                "_tofile" => $logFile
            );
        }

        //echo $msgString;

        //$output->appendToFile();
        //No html in log file
        return;
    }
1025126
public static function logInfo($msg, $mod = null, $file = 0, $line = 0)
    {
        $LOG = array('type' => 'INFO',
            'message' => (!is_null($msg) ? $msg : ''),
            'logFile' => (!is_null($file) ? $file : ''),
            'logLine' => (!is_null($line) ? $line : ''),
            'context' => (!is_null($mod) ? $mod : ''),
            'runtime' => round(self::getRelativeTime(), 4),);

        self::$Logs[] = $LOG;
    }
1113498
public function notificationAjax(string $title, string $message, string $type = 'default', bool $send_payload = TRUE): void
    {
        if ($this->isAjax())
        {
            $this->payload->notifications[] = $this->createNotification($title, $message, $type);

            if ($send_payload === TRUE)
            {
                $this->sendPayload();
            }
        }
    }
520503
protected function outputCustomFormatMessages($messages, $type)
    {
        foreach ($messages as $line => $messagesPerLine) {
            foreach ($messagesPerLine as $column => $messagesPerColumn) {
                foreach ($messagesPerColumn as $message) {
                    $msgType = $message['type'];
                    if ($type == $msgType) {
                        $logLevel = Project::MSG_INFO;
                        if ($msgType == 'ERROR') {
                            $logLevel = Project::MSG_ERR;
                        } else {
                            if ($msgType == 'WARNING') {
                                $logLevel = Project::MSG_WARN;
                            }
                        }
                        $text = $message['message'];
                        $string = $msgType . ' in line ' . $line . ' column ' . $column . ': ' . $text;
                        $this->log($string, $logLevel);
                    }
                }
            }
        }
    }
813806
protected function sysLog($msg, $level)
    {
        switch ($level) {
            case self::EMERG:
                $priority = LOG_EMERG;
                break;
            case self::ERROR:
                $priority = LOG_ERR;
                break;
            case self::WARN:
                $priority = LOG_WARNING;
                break;
            case self::DEBUG:
                $priority = LOG_DEBUG;
                break;
            case self::INFO:
            case self::PROC_INFO:
            case self::WORKER_INFO:
            default:
                $priority = LOG_INFO;
                break;
        }

        if (!$ret = syslog($priority, $msg)) {
            $this->stderr("Unable to write to syslog\n");
        }

        return $ret;
    }
684722
protected function output($message, $type = self::OUTPUT_INFO)
    {
        $output = $this->getOutput();

        if ($output === null) {
            return;
        }

        // Chose color type of message
        switch ($type) {
            case self::OUTPUT_COMMENT:
                $logMethod = 'info';
                $prefix = '<comment>';
                $postfix = '</comment>';
                break;

            case self::OUTPUT_ERROR:
                $logMethod = 'critical';
                $prefix = '<error>';
                $postfix = '</error>';
                break;

            case self::OUTPUT_INFO:
            default:
                $logMethod = 'info';
                $prefix = '<info>';
                $postfix = '</info>';
                break;
        }

        $psrLogBase = self::PSR_LOG_BASE;
        $consoleBase = self::SYMFONY_CONSOLE_BASE;

        if ($output instanceof $psrLogBase) {
            $output->$logMethod($message);

        } else {
            if ($output instanceof $consoleBase) {
                $output->writeln($prefix . $message . $postfix);
            }
        }

    }
1342590
public function enqueueMessage($msg, $type = 'message')
	{
		// For empty queue, if messages exists in the session, enqueue them first.
		if (!count($this->_messageQueue))
		{
			$session = JFactory::getSession();
			$sessionQueue = $session->get('application.queue');

			if (count($sessionQueue))
			{
				$this->_messageQueue = $sessionQueue;
				$session->set('application.queue', null);
			}
		}

		// Enqueue the message.
		$this->_messageQueue[] = array('message' => $msg, 'type' => strtolower($type));
	}
593321
public function log($message,$type="error",$prefix="err")
    {
        //msg
        $msg="time:".(string)date("Y-m-d H:i:s")."\r\n";
        $msg.="type:".$type."\r\n";
        $msg.="addr:".$_SERVER["REMOTE_ADDR"]."\r\n";
        $msg.="uri:".$_SERVER["REQUEST_URI"]."\r\n";
        $msg.="desc:".$message;
        $msg.="\r\n------------------------------------------------------------------------------------\r\n";

        //path
        $path=$this->getLogDir();
        $fn=Path::combinePath($path,str_replace(" ","_",$prefix)."_".(string)date("Ymd").".log");
        $fp=@fopen($fn,"ab");
        @fwrite($fp,$msg);
        @fclose($fp);
    }
165896
@Override
    @Trivial
    protected String getExecutionLogMessage(MessageType msgType) {

        LogHelper lh = new LogHelper();
        StringBuilder buf = lh.getBeginningPart(msgType);

        buf.append("invoking execution for a job");
        buf.append("\n JobInstance id = ");
        buf.append(getTopLevelNameInstanceExecutionInfo().getInstanceId());
        buf.append("\n JobExecution id = ");
        buf.append(getTopLevelNameInstanceExecutionInfo().getExecutionId());
        buf.append("\n Job Name = ");
        buf.append(getTopLevelNameInstanceExecutionInfo().getJobName());

        if (jobParameters != null) {
            buf.append("\n Job Parameters = ");
            buf.append(jobParameters);
        }

        if (!msgType.equals(MessageType.STARTED)) {
            buf.append("\n Job Batch Status = " + getBatchStatus());
            buf.append(", Job Exit Status = " + getExitStatus());
        }
        buf.append("\n" + LogHelper.dashes);
        return buf.toString();
    }
1252272
public function add($type, $message, $title = null)
    {
        $notifications = $this->getNotifications();

        $notifications[] = [
            'type'    => $type,
            'message' => $message,
            'title'   => $title
        ];

        $this->session->flash(self::SESSION_KEY, $notifications);
    }
173937
protected static function addLogBlockToFile($msgArray, $logType = 'Unknown')
    {
        //====================================================================//
        // Safety Check
        if (false == Splash::configuration()->Logging) {
            return true;
        }
        //====================================================================//
        // Run a Messages List
        if ((is_array($msgArray) || $msgArray instanceof Countable) && count($msgArray)) {
            foreach ($msgArray as $message) {
                //====================================================================//
                // Add Message To Log File
                self::addLogToFile(utf8_decode(html_entity_decode($message)), $logType);
            }
        }

        return true;
    }
241176
private function title($title, $type, $verboseLvl = null)
    {
        $this->simple('<'.$type.'>'.$title.'</'.$type.'>', $verboseLvl, false);
    }
200179
protected function createNotification(string $title, string $message, string $type): array
    {
        if (!in_array($type, Notification::TYPES))
        {
            $allowed_types = implode(', ', Notification::TYPES);
            throw new InvalidArgumentException("Wrong notification \$type '{$type}'. Use only '{$allowed_types}' types.");
        }

        return [
            'title' => $title,
            'message' => $message,
            'type' => $type,
        ];
    }
231755
public static function log($msg, $mod = null, $file = 0, $line = 0)
    {
        self::logInfo($msg, $mod, $file, $line);
    }
643218
public static function write_log($chain, $type, $file="", $line=""){
        /*if(filesize(PATHAPP . 'logs/log.txt') > 100000){           
            $arch= fopen(PATHAPP . 'logs/log.txt', "w");
            fclose($arch); 
        }*/
        $arch = fopen(PATHAPP . 'logs/log-' . date('Y-m-d') . '.txt', "a+"); 
        if(ENOLA_MODE == 'HTTP'){
            fwrite($arch, "[".date("Y-m-d H:i:s.u")." ".filter_input(INPUT_SERVER, 'REMOTE_ADDR')." "." - $type ] ".$chain." - $file - $line \n");
        }else{
            fwrite($arch, "[".date("Y-m-d H:i:s.u")." MODE CLI "." - $type ] ".$chain." - $file - $line \n");
        }
        fwrite($arch, "---------- \n");
        fclose($arch);
    }
429066
public function toastr(string $type, string $message = '', string $title = '', string $options = ''): string
    {
        return "toastr.$type('$message', '$title', $options);";
    }
709768
protected static function format_notification_message_text($messagetype,
                                                             $info,
                                                             $course,
                                                             $context,
                                                             $modulename,
                                                             $assignmentname) {
        $formatparams = array('context' => $context->get_course_context());
        $posttext  = format_string($course->shortname, true, $formatparams) .
                     ' -> ' .
                     $modulename .
                     ' -> ' .
                     format_string($assignmentname, true, $formatparams) . "\n";
        $posttext .= '---------------------------------------------------------------------' . "\n";
        $posttext .= get_string($messagetype . 'text', 'assign', $info)."\n";
        $posttext .= "\n---------------------------------------------------------------------\n";
        return $posttext;
    }