Source for file SqlLogger.php

Documentation is available at SqlLogger.php

  1. <?php
  2. /*
  3. * This file is part of Sylar.
  4. *
  5. * Sylar is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * Sylar is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public License
  16. * along with Sylar. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. * @copyright Copyright Sylar Development Team
  19. * @license http://www.gnu.org/licenses/ GNU Public License V2.0
  20. * @see https://launchpad.net/sylar/
  21. * @see http://www.giano-solutions.com
  22. */
  23.  
  24. /** Include the class ConfigBox */
  25.  
  26. import('sylar.common.system.ConfigBox');
  27. /** Import the class needed to extends DataBase */
  28.  
  29. import('sylar.common.db.mysql.MysqlDriver');
  30.  
  31.  
  32. /**
  33. * Sql layer for Logger
  34. *
  35. * @see Sylar_MysqlDriver
  36. * @see Sylar_DataBaseDriver
  37. * @see Sylar_Logger
  38. *
  39. * @package Sylar
  40. * @version 1.0
  41. * @since 12-2004
  42. * @author Gianluca Giusti [brdp] <g.giusti@giano-solutions.com>
  43. * @copyright Sylar Development Team
  44. */
  45. class Sylar_SqlLogger extends Sylar_MysqlDriver
  46. {
  47. function __construct(){
  48. parent::__construct();
  49. }
  50. /**
  51. * Log di un evento.
  52. * Logga l'azione nella categoria $sezione e con tipo log $tipo. Il livello
  53. * รจ in ordine decrescente.
  54. *
  55. * @todo move SQL in Sql Space!
  56. *
  57. * @since 12-2004
  58. * @author Gianluca Giusti [brdp] <g.giusti@giano-solutions.com>
  59. *
  60. * @return boolean
  61. * @param array $logInfo codice breve della sezione a cui appartiene l'evento
  62. */
  63. public function logEventInDb($logArray){
  64. #
  65. # Log the event
  66. #
  67. $sql = " insert into SYLAR_event_log
  68. (
  69. level,
  70. level_desc,
  71. ip_address,
  72. istant,
  73. event_desc,
  74. web_page,
  75. extra_info
  76. )
  77. values
  78. (
  79. ".$logArray[0].",
  80. '".$logArray[1]."',
  81. '".$logArray[2]."',
  82. NOW(),
  83. '".mysql_escape_string($logArray[3])."',
  84. '".mysql_escape_string($logArray[4])."',
  85. '".mysql_escape_string($logArray[5])."'
  86. )
  87. ";
  88.  
  89. if( $this->execSmartQuery($sql) ){
  90. return true;
  91. }else{
  92. return false;
  93. }
  94. }
  95. }
  96. ?>

Documentation generated on Thu, 24 Apr 2008 16:14:22 +0200 by phpDocumentor 1.3.0RC3