Ignore:
Timestamp:
Apr 24, 2015, 4:00:50 PM (9 years ago)
Author:
mistic100
Message:

feature 3221 Add Logger class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/ws_functions/pwg.images.php

    r31031 r31102  
    183183function merge_chunks($output_filepath, $original_sum, $type)
    184184{
    185   global $conf;
    186 
    187   ws_logfile('[merge_chunks] input parameter $output_filepath : '.$output_filepath);
     185  global $conf, $logger;
     186
     187  $logger->debug('[merge_chunks] input parameter $output_filepath : '.$output_filepath, 'WS');
    188188
    189189  if (is_file($output_filepath))
     
    207207      if (preg_match($pattern, $file))
    208208      {
    209         ws_logfile($file);
     209        $logger->debug($file, 'WS');
    210210        $chunks[] = $upload_dir.'/'.$file;
    211211      }
     
    217217
    218218  if (function_exists('memory_get_usage')) {
    219     ws_logfile('[merge_chunks] memory_get_usage before loading chunks: '.memory_get_usage());
     219    $logger->debug('[merge_chunks] memory_get_usage before loading chunks: '.memory_get_usage(), 'WS');
    220220  }
    221221
     
    227227
    228228    if (function_exists('memory_get_usage')) {
    229       ws_logfile('[merge_chunks] memory_get_usage on chunk '.++$i.': '.memory_get_usage());
     229      $logger->debug('[merge_chunks] memory_get_usage on chunk '.++$i.': '.memory_get_usage(), 'WS');
    230230    }
    231231
     
    239239
    240240  if (function_exists('memory_get_usage')) {
    241     ws_logfile('[merge_chunks] memory_get_usage after loading chunks: '.memory_get_usage());
     241    $logger->debug('[merge_chunks] memory_get_usage after loading chunks: '.memory_get_usage(), 'WS');
    242242  }
    243243}
     
    825825function ws_images_add_chunk($params, $service)
    826826{
    827   global $conf;
     827  global $conf, $logger;
    828828
    829829  foreach ($params as $param_key => $param_value)
     
    833833      continue;
    834834    }
    835     ws_logfile(
    836       sprintf(
    837         '[ws_images_add_chunk] input param "%s" : "%s"',
    838         $param_key,
    839         is_null($param_value) ? 'NULL' : $param_value
    840         )
    841       );
     835
     836    $logger->debug(sprintf(
     837      '[ws_images_add_chunk] input param "%s" : "%s"',
     838      $param_key,
     839      is_null($param_value) ? 'NULL' : $param_value
     840      ), 'WS');
    842841  }
    843842
     
    857856    );
    858857
    859   ws_logfile('[ws_images_add_chunk] data length : '.strlen($params['data']));
     858  $logger->debug('[ws_images_add_chunk] data length : '.strlen($params['data']), 'WS');
    860859
    861860  $bytes_written = file_put_contents(
     
    882881function ws_images_addFile($params, $service)
    883882{
    884   ws_logfile(__FUNCTION__.', input :  '.var_export($params, true));
    885 
    886   global $conf;
     883  global $conf, $logger;
     884
     885  $logger->debug(__FUNCTION__, 'WS', $params);
    887886
    888887  // what is the path and other infos about the photo?
     
    975974function ws_images_add($params, $service)
    976975{
    977   global $conf, $user;
     976  global $conf, $user, $logger;
    978977
    979978  foreach ($params as $param_key => $param_value)
    980979  {
    981     ws_logfile(
    982       sprintf(
    983         '[pwg.images.add] input param "%s" : "%s"',
    984         $param_key,
    985         is_null($param_value) ? 'NULL' : $param_value
    986         )
    987       );
     980    $logger->debug(sprintf(
     981      '[pwg.images.add] input param "%s" : "%s"',
     982      $param_key,
     983      is_null($param_value) ? 'NULL' : $param_value
     984      ), 'WS');
    988985  }
    989986
     
    13991396function ws_images_exist($params, $service)
    14001397{
    1401   ws_logfile(__FUNCTION__.' '.var_export($params, true));
    1402 
    1403   global $conf;
     1398  global $conf, $logger;
     1399
     1400  $logger->debug(__FUNCTION__, 'WS', $params);
    14041401
    14051402  $split_pattern = '/[\s,;\|]/';
     
    14721469function ws_images_checkFiles($params, $service)
    14731470{
    1474   ws_logfile(__FUNCTION__.', input :  '.var_export($params, true));
     1471  global $logger;
     1472
     1473  $logger->debug(__FUNCTION__, 'WS', $params);
    14751474
    14761475  $query = '
     
    15101509  if (isset($compare_type))
    15111510  {
    1512     ws_logfile(__FUNCTION__.', md5_file($path) = '.md5_file($path));
     1511    $logger->debug(__FUNCTION__.', md5_file($path) = '.md5_file($path), 'WS');
    15131512    if (md5_file($path) != $params[$compare_type.'_sum'])
    15141513    {
     
    15211520  }
    15221521
    1523   ws_logfile(__FUNCTION__.', output :  '.var_export($ret, true));
     1522  $logger->debug(__FUNCTION__, 'WS', $ret);
    15241523
    15251524  return $ret;
Note: See TracChangeset for help on using the changeset viewer.