<?php

namespace NewsletterBridge\Utils;

class Log {

    public static function start_script()
    {
        echo '**** START SCRIPT - '.date('Y-m-d H:i:s')." - **********\n";
    }


    public static function stop_script()
    {
        echo '**** END SCRIPT - '.date('Y-m-d H:i:s')." - **********\n";
    }


    public static function note($text)
    {
        if (!is_string($text)) {
            echo 'Note: '.json_encode($text).' - '.date('Y-m-d H:i:s')."\n";
        } else {
            echo 'Note: '.$text.' - '.date('Y-m-d H:i:s')."\n";
        }
    }


    public static function warning($text)
    {
        echo 'WARNING!!: '.$text.' - '.date('Y-m-d h:m:s')."\n";
    }


    public static function error($text)
    {
        echo 'ERROR!!: '.$text.' - '.date('Y-m-d h:m:s')."\n";
        self::stop_script();
        exit();
    }

    public static function info($text)
    {
        echo 'INFO: '.$text.' - '.date('Y-m-d h:m:s')."\n";
    }
}