BxDolLogsStorageSTDErr.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php defined('BX_DOL') or defined('BX_DOL_INSTALL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaCore UNA Core
  7. * @{
  8. */
  9. class BxDolLogsStorageSTDErr extends BxDolLogsStorageFolder implements iBxDolSingleton
  10. {
  11. /**
  12. * Get singleton instance of the class
  13. */
  14. public static function getInstance()
  15. {
  16. if(!isset($GLOBALS['bxDolClasses'][__CLASS__]))
  17. $GLOBALS['bxDolClasses'][__CLASS__] = new BxDolLogsStorageSTDErr();
  18. return $GLOBALS['bxDolClasses'][__CLASS__];
  19. }
  20. /**
  21. * Write to log
  22. * @param $oObject logs object
  23. * @param $mixed string or array to log
  24. * @return true on success or false on error
  25. */
  26. public function add($oObject, $mixed)
  27. {
  28. if (!$mixed)
  29. return true;
  30. $s = $this->formatLogString($oObject, $mixed, true);
  31. if (!($fd = fopen('php://stderr', 'w')))
  32. return false;
  33. if (false === fwrite($fd, $s))
  34. return false;
  35. fclose($fd);
  36. return true;
  37. }
  38. /**
  39. * Not supported
  40. */
  41. public function get($oObject, $iLines, $sFilter = false)
  42. {
  43. return false;
  44. }
  45. /**
  46. * Check if filtering supported in `get` method
  47. */
  48. public function isFilterAvail()
  49. {
  50. return false;
  51. }
  52. /**
  53. * Check if `get` method available
  54. */
  55. public function isGetAvail()
  56. {
  57. return false;
  58. }
  59. }
  60. /** @} */