<?php

Reg::get('di')->register('log', function(array $arg) {
  $file_name = null;
  if (isset($arg[0]) && is_string($arg[0])) {
    $file_name = $arg[0]; // filename
  }
  
  if (isset($arg[1]) && is_int($arg[1])) {
    $count = $arg[1]; // max count
    return new \tts\log($file_name, $count);
  }
  
  if (! empty($file_name)) {
    return new \tts\log($file_name);
  }
  
  return new \tts\log();
});