public function write_log($msg = '', $log_level = 0)
    {

        // log level check
        if ($this->log_level > (int)$log_level) return true;

        try {
            if (!$this->file->open((string)"$this->_log_path/$this->_file_name") && !$this->file->create_file("$this->_log_path/$this->_file_name")) {
                // $message = null, $code = null, $previous = null
                throw new LogException((string)"file: $this->_log_path/$this->_file_name couldn't be created.");
            }

            // check for the 2nd time
            $this->file->open("$this->_log_path/$this->_file_name");

            // if it doesn't exist add next line @ the end of the msg
            if (strpos($msg, "\n") === false) {
                $msg = "[" . (string)date(self::LOG_DATE_FORMAT) . (string)"] $msg " . "\n";
            } else {
                $msg = "[" . (string)date(self::LOG_DATE_FORMAT) . (string)"] $msg";
            }


            if ($this->file->append($msg) === false) {
                // some code
            }
            /*
             * while ( $this->file->append($msg) === false ) { /* // sleep 1
             * second sleep(1); if ( $start_time + 10 == time() ) { throw new
             * LogException("Sleep time for file:
             * $this->_log_path/$this->_file_name exceeded 10
             * seconds\n[msg]$msg"); break; } }
             */

        } catch (LogException $e) {
            error_log($e->getMessage());
        }

        return true;
    }