logthis

The WooCommerce Billogram Integration logthis function.

Description

logthis( $msg ); 

Parameters (1)

0. $msg
The msg.

Usage

  1. if ( !function_exists( 'logthis' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-billogram-integration/woocommerce-billogram2-extended.php'; 
  3.  
  4. // The msg. 
  5. $msg = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = logthis($msg); 
  9.  

Defined (1)

The function is defined in the following location(s).

/woocommerce-billogram2-extended.php  
  1. function logthis($msg) { 
  2. if(TESTING) { 
  3. $filePath = dirname(__FILE__).'/logfile.log'; 
  4. $archivedFilePath = dirname(__FILE__).'/logfile_archived.log'; 
  5. if(file_exists($filePath) && ceil(filesize($filePath)/(1024*1024)) > 2) { 
  6. rename($filePath, $archivedFilePath); 
  7. if(!file_exists($filePath)) { 
  8. $fileobject = fopen($filePath, 'a'); 
  9. chmod($filePath, 0666); 
  10. else{ 
  11. $fileobject = fopen($filePath, 'a'); 
  12. if(is_array($msg) || is_object($msg)) { 
  13. fwrite($fileobject, print_r($msg, true)); 
  14. else{ 
  15. fwrite($fileobject, date("Y-m-d H:i:s"). ":" . $msg . "\n"); 
  16. else{ 
  17. error_log($msg);