<?php

namespace ZenoChatbot\Framework\Foundation;

class Logger
{
    public function log($content)
    {

        if (is_array($content)) {
            $content = json_encode($content);
        }

        if (is_object($content)) {
            $content = print_r($content, true);
        }

        if ($content instanceof \Exception) {
            $content = $content->getMessage();
            $content .= "\n" . $content->getTraceAsString();
        }

        if (defined('WP_DEBUG') && WP_DEBUG) {
            error_log($content);
        }
    }
}
