public function export()
    {
        $rows = [];
        foreach ($this->messages as $message) {
            list($text, $level, $category, $timestamp) = $message;
            if (!is_string($text)) {
                // exceptions may not be serializable if in the call stack somewhere is a Closure
                if ($text instanceof \Throwable || $text instanceof \Exception) {
                    $text = (string) $text;
                } else {
                    $text = VarDumper::export($text);
                }
            }
            $rows[] = [
                'level' => $level,
                'category' => $category,
                'log_time' => $timestamp,
                'prefix' => $this->getMessagePrefix($message),
                'message' => $text,
            ];
        }

        $this->db->getCollection($this->logCollection)->batchInsert($rows);
    }
public function export()
    {
        $rows = [];
        foreach ($this->messages as $message) {
            list($text, $level, $category, $timestamp) = $message;
            if (!is_string($text)) {
                // exceptions may not be serializable if in the call stack somewhere is a Closure
                if ($text instanceof \Throwable || $text instanceof \Exception) {
                    $text = (string) $text;
                } else {
                    $text = VarDumper::export($text);
                }
            }
            $rows[] = [
                'level' => $level,
                'category' => $category,
                'log_time' => $timestamp,
                'prefix' => $this->getMessagePrefix($message),
                'message' => $text,
            ];
        }

        $this->db->getCollection($this->logCollection)->batchInsert($rows);
    }
public function export ( ) { $ rows = [ ] ; foreach ( $ this -> messages as $ message ) { list ( $ text , $ level , $ category , $ timestamp ) = $ message ; if ( ! is_string ( $ text ) ) { // exceptions may not be serializable if in the call stack somewhere is a Closure if ( $ text instanceof \ Throwable || $ text instanceof \ Exception ) { $ text = ( string ) $ text ; } else { $ text = VarDumper :: export ( $ text ) ; } } $ rows [ ] = [ 'level' => $ level , 'category' => $ category , 'log_time' => $ timestamp , 'prefix' => $ this -> getMessagePrefix ( $ message ) , 'message' => $ text , ] ; } $ this -> db -> getCollection ( $ this -> logCollection ) -> batchInsert ( $ rows ) ; }
Stores log messages to MongoDB collection.
Stores log messages to MongoDB collection .