Builds the message as it will appear in the log file

@author Art <a.molcanovas@gmail.com>

@param string $level Message level
@param string $text  User-supplied message text

@return string The built message
@since  1.4
3327
protected function buildMessage($level, $text) {
            $trace = Alo::ifnull($this->getBacktrace()[1], [], true);

            $file = isset($trace['file']) ? implode(DIRECTORY_SEPARATOR,
                                                    array_slice(explode(DIRECTORY_SEPARATOR,
                                                                        $trace['file']),
                                                                -2)) : '<<unknown file>>';
            $line = isset($trace['line']) ? implode(DIRECTORY_SEPARATOR,
                                                    array_slice(explode(DIRECTORY_SEPARATOR,
                                                                        $trace['line']),
                                                                -2)) : '<<unknown line>>';

            return $level . ' ' . self::SEPARATOR . ' ' . $this->time() . ' ' . self::SEPARATOR . ' ' .
                   $this->config->logLabel . ' ' . self::SEPARATOR . ' ' .
                   str_replace(self::SEPARATOR, '\\' . self::SEPARATOR, $text) . ' ' . self::SEPARATOR . ' ' . $file .
                   ' ' . self::SEPARATOR . ' ' . $line . PHP_EOL;
        }
552220
protected String indentText( int level, String text )
    {
        StringBuilder buffer = new StringBuilder();
        String[] lines = text.split( "\n" );
        String prefix = StringUtils.leftPad( "", level );
        for ( String line : lines )
        {
            buffer.append( prefix ).append( line ).append( EOL );
        }
        return buffer.toString();
    }
867361
public function log($level, $message, array $context = [])
    {
        if (!isset($this->logLevels[$level])) {
            $level = LogLevel::DEBUG;
        }

        if ($this->logLevels[$level] < $this->level) {
            // do not print.
            return;
        }

        if ($this->level === 3 && $this->logLevels[$level] === 3) {
            $style = 'dim';
        } else {
            $style = $this->levelStyles[$level];
        }

        if ($this->indent) {
            $this->write(\str_repeat($this->indentCharacter, $this->indent));
        }

        if (\is_object($message) || \is_array($message)) {
            $this->writeln(\print_r($message, true), $style);
        } else {
            $this->writeln($message, $style);
        }
    }
557871
public function logMessage($message, $level = 0) {
        $this->getLogFile();
        if (!flock($this->_fp, LOCK_EX)) {
            throw new LoggerFileException('Can\'t obtain file lock for: ');
        }
        $text = '[' . date("H:i:s") . ']' . $this->_levelNames[$level] . " " . $message . "\n"; // Log message
        if (fwrite($this->_fp, $text)) {
            flock($this->_fp, LOCK_UN);
            return true;
        } else {
            flock($this->_fp, LOCK_UN);
            throw new LoggerFileException('Can\'t write to logfile!');
        }
    }
836297
public function add_message( $message, $level = null ) {
		if ( ! $message instanceof Message ) {
			$message = new Message( compact( 'message', 'level' ) );
		}

		// Push the messages in the queue.
		$this->messages->push( $message );

		return $this->flash();
	}
1323957
public function log($level, $message)
    {
        if (func_num_args() > 3) {
            $args = array_slice(func_get_args(), 3);
            if (is_array($args[0])) {
                $args = $args[0];
            }
            $this->log->write($level, $this->className, $message, $args);
        } else {
            $this->log->write($level, $this->className, $message);
        }
    }
1297898
public function log($level, $message, array $context = array())
    {
        $messageArray = [
            date('Y/m/d H:i:s')." [". $level . "] " . $message
        ];

        if (!empty($context)) {
            $messageArray[] = 'Context:';
            foreach ($context as $key => $value) {
                $messageArray[] =  $key . ' => ' . var_export($value, true);
            }
        }
        $trace = $this->getTrace();
        $messageArray[] = 'Trace:';
        $messageArray[] = $trace['trace'];

        $file = $this->path . DIRECTORY_SEPARATOR . 'application.log';
        if (!file_exists($this->path)) {
            mkdir($this->path, 0777, true);
        }

        file_put_contents(
            $file,
            implode("\n", $messageArray),
            FILE_APPEND
        );
    }
938589
public function log($msg, $level = Project::MSG_INFO)
    {
        $this->logObject($this, $msg, $level);
    }
393016
protected function log(/*# string */ $level, /*# string */ $message)
    {
        if ($this->debug_mode) {
            $this->debugger->log(
                $level,
                $message,
                [ 'className' => get_class($this) ]
            );
        }
        return $this;
    }
1293210
public function log($level, $message, array $context = [])
    {
        if ( ! in_array($level, $this->threshold)) {
            return false;
        }

        // Try to get language message
        $langMessage = language()->getLine($message, $context);

        // Re-Define message
        $message = empty($langMessage) ? $message : $langMessage;

        if ( ! is_dir($this->path)) {
            mkdir($this->path, true, 0775);
        }

        $this->lines[] = new \ArrayObject([
            'level'   => strtoupper($level),
            'time'    => date('r'),
            'message' => $message,
        ], \ArrayObject::ARRAY_AS_PROPS);

        $isNewFile = false;
        $filePath = $this->path . 'log-' . date('d-m-Y') . '.log';

        $log = '';

        if ( ! is_file($filePath)) {
            $isNewFile = true;
        }

        if ( ! $fp = @fopen($filePath, 'ab')) {
            return false;
        }

        $log .= strtoupper($level) . ' - ' . date('r') . ' --> ' . $message . "\n";

        flock($fp, LOCK_EX);

        $result = null;
        for ($written = 0, $length = strlen($log); $written < $length; $written += $result) {
            if (($result = fwrite($fp, substr($log, $written))) === false) {
                break;
            }
        }

        flock($fp, LOCK_UN);
        fclose($fp);

        if ($isNewFile === true) {
            chmod($filePath, 0664);
        }

        return (bool)is_int($result);
    }
1140768
public function log($message, $level = LogLevel::INFO, $context = array())
    {
        $this->buildLogger->log($message, $level, $context);
    }
931337
public static function text($text, $outfile = false, $level = Constants::QR_ECLEVEL_L, $size = 3, $margin = 4)
    {
        $enc = QRencode::factory($level, $size, $margin);
        return $enc->encode($text, $outfile);
    }
855454
public function setHeading($text, $level = 3)
    {
        $this->heading = new Heading($text, $level);
        $this->heading->entity->setEntityName($text);

        return $this;
    }
840773
public static function translate($text)
    {
        $args = func_get_args();
        unset($args[0]);
        
        if (isset(self::$messages[$text])) {
            $text = self::$messages[$text];
        }
        
        return vsprintf($text, $args);
    }
1059189
public function buildMessage()
    {
        if (!empty($this->message)) {
            return $this->message;
        }

        foreach ($this->texts as $text) {
            $this->message[] = [
                'type' => MessageType::TEXT,
                'text' => $text,
            ];
        }

        if ($this->quickReply) {
            $lastKey = count($this->message) - 1;

            // If the user receives multiple message objects.
            // The quickReply property of the last message object is displayed.
            $this->message[$lastKey]['quickReply'] = $this->quickReply->buildQuickReply();
        }

        return $this->message;
    }
1227826
public function log($level, $message, array $context = array())
    {
        if($context != []){
            /** @var DumpFile $dumpFile */
            $dumpFile = true;

            $t = $this->logFile->log($message, $level, $dumpFile);
            $dumpFile->writeSerialized($context);
        } else {
            $t = $this->logFile->log($message, $level);
        }

        return $t;

    }
1344420
private function loggerLevel($level)
    {
        switch ($level) {
            case 'trace':
            case 'debug':
                return Logger::DEBUG;
                break;

            case 'info':
                return Logger::INFO;
                break;

            case 'notice':
                return Logger::NOTICE;
                break;

            case 'warn':
            case 'warning':
                return Logger::WARNING;
                break;

            case 'error':
                return Logger::ERROR;
                break;

            case 'crit':
            case 'critical':
                return Logger::CRITICAL;
                break;

            case 'alert':
                return Logger::ALERT;
                break;

            case 'emergency':
                return Logger::EMERGENCY;
                break;

            default:
                throw new \Exception('Unknown Log Level', 1);
                break;
        }
    }