<?php

namespace Shared;

class Logger
{
    private $filePath;
    private $logToSTDOut;

    public function __construct($fPath,$logToSTDOut)
    {
        $this->logToSTDOut=$logToSTDOut;
        $this->filePath=$fPath;
    }

    public function ClearLog()
    {
        $fh = fopen( $this->filePath, 'w' );
        fclose($fh);  
    }

    public function LogString($string)
    {
        //todo sync
        $dt=new \DateTime();
        $timestring=$dt->format('Y-m-d H:i:s');
        $logstring=$timestring." ". $string."\r\n";
        file_put_contents ($this->filePath, $logstring , FILE_APPEND | LOCK_EX);
        echo $logstring;
    }

    public function LogObject($object)
    {

    }
        
}
