<?php

class CSocketLogRoute extends CLogRoute
{

  public $host = "127.0.0.1";

  public $port = 9999;

  protected function processLogs($logs)
  {
    foreach ( $logs as $log )
    {
      list ( $message, $level, $category, $time ) = $log;
      $finalMessage = $this->formatLogMessage ( $message, $level, $category, $time );
      // $finalMessage = $this->formatLogMessage ( $log [0], $log [1], $log [2], $log [3] ) ;
      $finalMessage = trim ( $finalMessage );
      TcpClient::writeTo ( $this->host, $this->port, $finalMessage );
      /*
       * $file_cat = pathCombine ( app ()->basePath, 'runtime', 'log', 'categories', $category );
       * if (! fileExists ( $file_cat ))
       * file_put_contents ( $file_cat, '' );
       * $file_lvl = pathCombine ( app ()->basePath, 'runtime', 'log', 'levels', $level );
       * if (! fileExists ( $file_lvl ))
       * file_put_contents ( $file_lvl, '' );
       */
    }
  }
}