A dump yet clever way to debug wp-cron

A new way:


//Get log from cron jobs:
$output = json_encode($YOUR_OBEJCT);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://www.369usa.com/msg/");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
            "log=".$output);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close ($ch);die;

Call this url: https://www.369usa.com/msg/log.json

Alter the log by inserting a flag:

public function log($msg, $context = [],$flag = false)
    {
        if(!$flag) return;
        ......

Apply the altered log:

$output = json_encode( YOUR_VARIABLE );
$logger->log($output,[],true);die;