Logger.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?php namespace Config;
  2. use CodeIgniter\Config\BaseConfig;
  3. class Logger extends BaseConfig
  4. {
  5. /*
  6. |--------------------------------------------------------------------------
  7. | Error Logging Threshold
  8. |--------------------------------------------------------------------------
  9. |
  10. | You can enable error logging by setting a threshold over zero. The
  11. | threshold determines what gets logged. Any values below or equal to the
  12. | threshold will be logged. Threshold options are:
  13. |
  14. | 0 = Disables logging, Error logging TURNED OFF
  15. | 1 = Emergency Messages - System is unusable
  16. | 2 = Alert Messages - Action Must Be Taken Immediately
  17. | 3 = Critical Messages - Application component unavailable, unexpected exception.
  18. | 4 = Runtime Errors - Don't need immediate action, but should be monitored.
  19. | 5 = Warnings - Exceptional occurrences that are not errors.
  20. | 6 = Notices - Normal but significant events.
  21. | 7 = Info - Interesting events, like user logging in, etc.
  22. | 8 = Debug - Detailed debug information.
  23. | 9 = All Messages
  24. |
  25. | You can also pass an array with threshold levels to show individual error types
  26. |
  27. | array(1, 2, 3, 8) = Emergency, Alert, Critical, and Debug messages
  28. |
  29. | For a live site you'll usually enable Critical or higher (3) to be logged otherwise
  30. | your log files will fill up very fast.
  31. |
  32. */
  33. public $threshold = 9;
  34. /*
  35. |--------------------------------------------------------------------------
  36. | Date Format for Logs
  37. |--------------------------------------------------------------------------
  38. |
  39. | Each item that is logged has an associated date. You can use PHP date
  40. | codes to set your own date formatting
  41. |
  42. */
  43. public $dateFormat = 'Y-m-d H:i:s';
  44. /*
  45. |--------------------------------------------------------------------------
  46. | Log Handlers
  47. |--------------------------------------------------------------------------
  48. |
  49. | The logging system supports multiple actions to be taken when something
  50. | is logged. This is done by allowing for multiple Handlers, special classes
  51. | designed to write the log to their chosen destinations, whether that is
  52. | a file on the getServer, a cloud-based service, or even taking actions such
  53. | as emailing the dev team.
  54. |
  55. | Each handler is defined by the class name used for that handler, and it
  56. | MUST implement the CodeIgniter\Log\Handlers\HandlerInterface interface.
  57. |
  58. | The value of each key is an array of configuration items that are sent
  59. | to the constructor of each handler. The only required configuration item
  60. | is the 'handles' element, which must be an array of integer log levels.
  61. | This is most easily handled by using the constants defined in the
  62. | Psr\Log\LogLevel class.
  63. |
  64. | Handlers are executed in the order defined in this array, starting with
  65. | the handler on top and continuing down.
  66. |
  67. */
  68. public $handlers = [
  69. //--------------------------------------------------------------------
  70. // File Handler
  71. //--------------------------------------------------------------------
  72. 'CodeIgniter\Log\Handlers\FileHandler' => [
  73. /*
  74. * The log levels that this handler will handle.
  75. */
  76. 'handles' => [
  77. 'critical',
  78. 'alert',
  79. 'emergency',
  80. 'debug',
  81. 'error',
  82. 'info',
  83. 'notice',
  84. 'warning',
  85. ],
  86. /*
  87. * The default filename extension for log files.
  88. * An extension of 'php' allows for protecting the log files via basic
  89. * scripting, when they are to be stored under a publicly accessible directory.
  90. *
  91. * Note: Leaving it blank will default to 'log'.
  92. */
  93. 'fileExtension' => '',
  94. /*
  95. * The file system permissions to be applied on newly created log files.
  96. *
  97. * IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
  98. * integer notation (i.e. 0700, 0644, etc.)
  99. */
  100. 'filePermissions' => 0644,
  101. /*
  102. * Logging Directory Path
  103. *
  104. * By default, logs are written to WRITEPATH . 'logs/'
  105. * Specify a different destination here, if desired.
  106. */
  107. 'path' => '',
  108. ],
  109. /**
  110. * The ChromeLoggerHandler requires the use of the Chrome web browser
  111. * and the ChromeLogger extension. Uncomment this block to use it.
  112. */
  113. // 'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => [
  114. // /*
  115. // * The log levels that this handler will handle.
  116. // */
  117. // 'handles' => ['critical', 'alert', 'emergency', 'debug',
  118. // 'error', 'info', 'notice', 'warning'],
  119. // ]
  120. ];
  121. }