Add a Messages Block to Log File

@param null|array|ArrayObject $msgArray Array of Message text to log
@param string                 $logType  Message Type

@return true
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;
    }
1004931
public function warn($str, $logType = "") {
        if ($this->_level >= self::WARN) {
            //$this->put("[WARN] [$str] ".$this->caller(), $this->_wfName);
            $this->put("$str ".$this->caller(), self::WARN);
        }
    }
216898
private static function addLog($message, $log_type, Tree $tree = null): void
    {
        if (app()->has(ServerRequestInterface::class)) {
            $request    = app(ServerRequestInterface::class);
            $ip_address = $request->getServerParams()['REMOTE_ADDR'] ?? '127.0.0.1';
        } else {
            $ip_address = '127.0.0.1';
        }
        $tree_id    = $tree ? $tree->id() : null;

        DB::table('log')->insert([
            'log_type'    => $log_type,
            'log_message' => $message,
            'ip_address'  => $ip_address,
            'user_id'     => Auth::id(),
            'gedcom_id'   => $tree_id,
        ]);
    }
757097
public function setMessageType(\BisonLab\SakonninBundle\Entity\MessageType $messageType = null)
    {
        $this->message_type = $messageType;

        return $this;
    }
22664
public function addMessage($messages, $type = Bootstrap::MSG_INFO)
    {
        if (!$this->mute) {
            $this->app->addMessage($messages, $type);
        }

        return $this;
    }
711340
protected function writeMsgId(array $entry, $type = 'msgid')
    {
        $result = '';

        if (!isset($entry[$type])) {
            return $result;
        }

        $result .= $type . ' ';
        if (is_array($entry[$type])) {
            foreach ($entry[$type] as $id) {
                $result .= $this->cleanExport($id) . "\n";
            }
        } else {
            $result .= $this->cleanExport($entry[$type]) . "\n";
        }

        return $result;
    }
286531
protected function log($type, $msg)
    {
        $msg    = trim($msg);
        if ('' == $msg) {
            return false;
        }

        $filesystem = $this->filesystem;
        if (!$filesystem->isDirectory($this->dirPath)) {
            return false;
        }

        $type       = intval($type);
        $subPath    = sprintf("%s%s%s%s", date('Y'), DIRECTORY_SEPARATOR, date('m'), DIRECTORY_SEPARATOR);
        $file       = $this->dirPath . DIRECTORY_SEPARATOR . $subPath;
        switch($type) {
            case self::TYPE_DEBUG:
                $file   .= "debug";
                $str     = "[debug]";
                break;
            case self::TYPE_INFO:
                $file   .= "info";
                $str     = "[info]";
                break;
            case self::TYPE_NOTICE:
                $file   .= "notice";
                $str     = "[notice]";
                break;
            case self::TYPE_WARNING:
                $file   .= "warning";
                $str     = "[warning]";
                break;
            case self::TYPE_ERROR:
                $file   .= "error";
                $str     = "[error]";
                break;
            case self::TYPE_API:
                $file   .= "api";
                $str     = "[api]";
                break;
            case self::TYPE_DB:
                $file   .= "db";
                $str     = "[db]";
                break;
            // @codeCoverageIgnoreStart
            default:
                return false;
        }
        // @codeCoverageIgnoreEnd
        $file       .= '_' . date('Y_m_d');
        $target     = $file . '_' . date('His') . '.log';
        $file       .= '.log';

        // check log file size
        if ($filesystem->isFile($file) && ($filesystem->size($file) > self::MAX_FILE_SIZE)) {
            $filesystem->move($file, $target);
        }

        // Determine if log dir exists
        $dirPath    = $filesystem->dirName($file);
        if (!$filesystem->isDirectory($dirPath)) {
            $filesystem->makeDirectory($dirPath, 0755, true, true);
        }

        $str        .= date('Y-m-d H:i:s') . '|' . $msg . "\n";

        return $filesystem->append($file, $str) > 0;
    }
134451
public function addMessages($messages, $storageType)
    {
        if ($messages instanceof Mage_Core_Model_Message_Collection) {
            $messages = $messages->getItems();
        }

        $this->scheduledMessages[$storageType] = $messages;
        return $this;
    }
758770
public function addMessage(AddMessageEvent $event)
    {
        /** @var Message $messageAdapter */
        $messageAdapter = $this->framework->getAdapter(Message::class);

        $messageAdapter->add($event->getContent(), 'TL_' . strtoupper($event->getType()));
    }
360697
private function mergeCore($logType, $logArray)
    {
        //====================================================================//
        // Fast Line
        if (empty($logArray)) {
            return;
        }
        //====================================================================//
        // Detect ArrayObjects
        if ($logArray instanceof ArrayObject) {
            $logArray = $logArray->getArrayCopy();
        }
        //====================================================================//
        // If Current Log is Empty
        if (!isset($this->{$logType})) {
            $this->{$logType} = $logArray;
        //====================================================================//
        // Really merge Logs
        } else {
            foreach ($logArray as $message) {
                array_push($this->{$logType}, $message);
            }
        }
    }
188206
public function log($msg, $type = ShopgateLogger::LOGTYPE_ERROR)
    {
        return ShopgateLogger::getInstance()->log($msg, $type);
    }
55633
public function log($str, $type = 'notice', $data = [])
    {
        $log = new \Monolog\Logger('task_log');
        
        //add file handler - log to file
        $log->pushHandler(
            new \Monolog\Handler\StreamHandler('logs/'.date('Y-m-d').'.log')
        );
        
        $method = 'add'.$type;
        if (method_exists($log, $type)) {
            $log->$method($str, $data);
        }
    }
120969
public function addMessages($messages, $type = null)
    {
        $model = 'infoMessages';
        switch ($type) {
            case 'error':
            case 'danger':
                $model = 'errorMessages';
                break;
            case 'success':
                $model = 'successMessages';
                break;
            case 'warning':
                $model = 'warningMessages';
                break;
        }
        foreach ((array)$messages as $key => $value) {
            array_push($this->$model, $value);
        }

        return $this;
    }
409974
function addLoggers($loggers)
	{
		foreach(func_get_args() as $logger)
		{
			if(is_array($logger))
			{
				foreach($logger as $sublogger)
				{
					$this->addLoggers($sublogger);
				}
			}
			else if(is_object($logger))
			{
				$this->_loggers[] = $logger;
			}
		}

		return $this;
	}
398845
public function log($type = null, $data = [])
    {
        if (!func_num_args()) {
            return $this->_log;
        }
        $this->report($type, $this->log()->add($type, $data));
    }
719310
protected function assertValidMessageType($messageType)
    {
        if (!in_array($messageType, [self::TYPE_PHP, self::TYPE_SAPI], true)) {
            throw new \InvalidArgumentException('MessageType "%s" is not valid', $messageType);
        }
    }
578863
protected function _loadMessagesFromStorage($type) {
        foreach (Mage::getSingleton($type)
                    ->getMessages(true)->getItems() as $msg) {
            parent::addMessage($msg);
        }
    }