protected function add_log($message, $level, $a = null, $depth = null, $display = false) {
        // Adding the result to the oldest parent.
        if ($this->get_parent()) {
            $parent = $this->get_grandparent();
            $parent->add_log($message, $level, $a, $depth, $display);
        } else {
            $log = new stdClass();
            $log->message = $message;
            $log->level = $level;
            $log->a = $a;
            $log->depth = $depth;
            $log->display = $display;
            $this->logs[] = $log;
        }
    }