<?php

class DBG
{
  public static function writeLine($line)
  {
    DBG::writeText("[".date("Y-m-d H:i:s")."] ".$line);
  }

  public static function writeText($line)
  {
    DBG::writeRaw($line,'text');
  }

  public static function writeObj($obj)
  {
    DBG::writeText(print_r($obj,true));
  }

  public static function writeData($obj)
  {
    DBG::writeRaw(json_encode($obj),'data');
  }

  public static function sendCommand($command)
  {
    DBG::writeRaw($command,'command');
  }

  public static function sendClear()
  {
    DBG::sendCommand("CLEAR");
  }

  public static function writeRaw($obj,$type)
  {
    $filename = "C:\\Temp\\PHPDBG_".date("YmdHis")."_".microtime()."_$type.log";
    file_put_contents ($filename, $obj);
  }

  public static function sendEnable()
  {
    DBG::sendCommand("ENABLE");
  }

  public static function sendDisable()
  {
    DBG::sendCommand("DISABLE");
  }

}

?>