12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace core\basic;
- use core\log\LogText;
- use core\log\LogDb;
- class Log
- {
-
- protected static function getLogInstance()
- {
- switch (Config::get('log_record_type')) {
- case 'text':
- $instance = LogText::getInstance();
- break;
- case 'db':
- $instance = LogDb::getInstance();
- break;
- default:
- $instance = LogText::getInstance();
- }
- return $instance;
- }
-
- public static function write($content, $level = "info", $username = null)
- {
- $log = self::getLogInstance();
- $log->write($content, $level, $username);
- }
-
- public static function error($content)
- {
- $log = self::getLogInstance();
- $log->error($content);
- }
-
- public static function info($content)
- {
- $log = self::getLogInstance();
- $log->info($content);
- }
- }
|