{"id":21744742,"url":"https://github.com/cdoco/easylog","last_synced_at":"2025-04-13T05:12:15.863Z","repository":{"id":85205845,"uuid":"96182415","full_name":"cdoco/easylog","owner":"cdoco","description":"Logging system of php based on Easylogging++","archived":false,"fork":false,"pushed_at":"2018-05-15T02:50:13.000Z","size":98,"stargazers_count":12,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T22:04:40.789Z","etag":null,"topics":["easyloggingpp","log","php-extension","php-log","php7"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cdoco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-04T06:21:24.000Z","updated_at":"2024-03-04T02:29:27.000Z","dependencies_parsed_at":"2023-03-13T04:39:51.599Z","dependency_job_id":null,"html_url":"https://github.com/cdoco/easylog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdoco%2Feasylog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdoco%2Feasylog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdoco%2Feasylog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdoco%2Feasylog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdoco","download_url":"https://codeload.github.com/cdoco/easylog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665743,"owners_count":21142123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["easyloggingpp","log","php-extension","php-log","php7"],"created_at":"2024-11-26T07:12:25.405Z","updated_at":"2025-04-13T05:12:15.856Z","avatar_url":"https://github.com/cdoco.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Easylog\nLogging system based on [Easylogging++](https://github.com/muflihun/easyloggingpp)\n\n## Installation\n\n```shell\nphpize \u0026\u0026 ./configure \u0026\u0026 make \u0026\u0026 make install\n```\n\n## Basic Usage\n\n### php.ini\n\n```ini\nextension=easylog.so\n\n[easylog]\neasylog.config_file = \"/data/easylog.conf\"\n\n// Level: global trace debug fatal error warning verbose info unknown\neasylog.log_level = \"info\"\n```\n\n### Quick start\n\n```php\n\u003c?php\n    //设置日志级别\n    Easylog::setLevel(Easylog::ERROR);\n\n    //自定义格式符\n    Easylog::setCustomFormat(\"%ip\", \"172.16.2.111\");\n\n    //设置 logger ID\n    //这个 id 必须在配置文件中存在\n    $easylog = new Easylog(\"easylog\");\n\n    //设置 info 级别的格式\n    $easylog-\u003esetFormat(Easylog::INFO, \"[%datetime{%Y-%M-%d %H:%m:%s}] %logger.%level %ip | %msg\");\n\n    $easylog-\u003einfo(\"info\");\n    $easylog-\u003ewarning(\"warning\");\n    $easylog-\u003eerror(\"error\");\n    $easylog-\u003edebug(\"debug\");\n    $easylog-\u003etrace(\"trace\");\n    $easylog-\u003efatal(\"fatal\");\n\n    $zy = new Easylog(\"zy\");\n\n    //Determines format of logging corresponding level and logger.\n    $zy-\u003esetFormat(Easylog::GLOBAL, \"[%datetime{%Y-%M-%d %H:%m:%s}] %logger.%level | %msg\");\n\n    //Whether or not to write corresponding log to log file\n    $zy-\u003esetToFile(Easylog::GLOBAL, \"true\");\n\n    //Determines log file (full path) to write logs to for correponding level and logger\n    $zy-\u003esetFileName(Easylog::GLOBAL, \"/data/logs/php/zy.log\");\n\n    //If file size of corresponding log file (for corresponding level) is \u003e= specified size, log file will be truncated and re-initiated.\n    $zy-\u003esetMaxLogFileSize(Easylog::GLOBAL, \"2097152\");\n\n    //Whether or not to write corresponding level and logger log to standard output\n    $zy-\u003esetToStandardOutput(Easylog::GLOBAL, \"true\");\n\n    //This does not depend on logger or level. Performance tracking always uses 'performance' logger\n    $zy-\u003esetPerformanceTracking(Easylog::GLOBAL, \"false\");\n\n    //Specifies number of log entries to hold until we flush pending log data\n    $zy-\u003esetLogFlushThreshold(Easylog::GLOBAL, \"1\");\n\n    //Alias of SubsecondPrecision (for backward compatibility)\n    $zy-\u003esetMillisecondsWidth(Easylog::GLOBAL, \"3\");\n\n    $zy-\u003einfo(\"info\");\n    $zy-\u003ewarning(\"warning\");\n```\n\n### Configuring file\n\n```conf\n-- default // logger id\n    * GLOBAL:\n        ENABLED                 =   true\n        TO_FILE                 =   true\n        TO_STANDARD_OUTPUT      =   true\n        FORMAT                  =   \"[%datetime{%Y-%M-%d %H:%m:%s}] %logger.%level | %msg\"\n        FILENAME                =   \"/data/logs/php/log_%datetime{%Y%M%d}.log\"\n        MILLISECONDS_WIDTH      =   3\n        PERFORMANCE_TRACKING    =   false\n        MAX_LOG_FILE_SIZE       =   1048576\n        LOG_FLUSH_THRESHOLD     =   0\n\n    * TRACE:\n        FILENAME                =   \"/data/logs/php/trace_%datetime{%Y%M%d}.log\"\n\n    * DEBUG:\n        FILENAME                =   \"/data/logs/php/debug_%datetime{%Y%M%d}.log\"\n\n    * FATAL:\n        ENABLED                 =   false \n\n    * ERROR:\n        FILENAME                =   \"/data/logs/php/error_%datetime{%Y%M%d}.log\"\n\n    * WARNING:\n        FILENAME                =   \"/data/logs/php/warning_%datetime{%Y%M%d}.log\"\n\n    * INFO:\n        FILENAME                =   \"/data/logs/php/info_%datetime{%Y%M%d}.log\"\n\n    * VERBOSE:  \n        ENABLED                 =   false\n\n-- easylog // logger id\n    * GLOBAL:\n        ENABLED                 =   true\n        TO_FILE                 =   true\n        TO_STANDARD_OUTPUT      =   true\n        FORMAT                  =   \"[%datetime{%Y-%M-%d %H:%m:%s}] %logger.%level | %msg\"\n        FILENAME                =   \"/data/logs/php/easylog/log_%datetime{%Y%M%d}.log\"\n        MILLISECONDS_WIDTH      =   3\n        PERFORMANCE_TRACKING    =   false\n        MAX_LOG_FILE_SIZE       =   1048576\n        LOG_FLUSH_THRESHOLD     =   0\n\n    * INFO:\n        FILENAME                =   \"/data/logs/php/easylog/info_%datetime{%Y%M%d}.log\"\n\n    * ERROR:\n        FILENAME                =   \"/data/logs/php/easylog/error_%datetime{%Y%M%d}.log\"\n```\n\n#### Configuration Options\n\n|   Configuration Name  |   Type   |                 Description                                                                                                                                                 |\n|-----------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `Enabled`               |   bool   | Determines whether or not corresponding level for logger is enabled. You may disable all logs by using |\n| `To_File`               |   bool   | Whether or not to write corresponding log to log file  |\n| `To_Standard_Output`    |   bool   | Whether or not to write logs to standard output e.g, terminal or command prompt  |\n| `Format`                |   char*  | Determines format/pattern of logging for corresponding level and logger.         |\n| `Filename`              |   char*  | Determines log file (full path) to write logs to for corresponding level and logger   |\n| `Subsecond_Precision`   |   uint   | Specifies subsecond precision (previously called 'milliseconds width'). Width can be within range (1-6)  |\n| `Performance_Tracking`  |   bool   | Determines whether or not performance tracking is enabled. This does not depend on logger or level. Performance tracking always uses 'performance' logger unless specified|\n| `Max_Log_File_Size`     |   size_t | If log file size of corresponding level is \u003e= specified size, log file will be truncated.    |\n| `Log_Flush_Threshold`   |  size_t  | Specifies number of log entries to hold until we flush pending log data.    |                               \n\n#### Date/Time Format Specifiers\nYou can customize date/time format using following specifiers\n\n|    Specifier    |                 Replaced By                                                                                      |\n|-----------------|------------------------------------------------------------------------------------------------------------------|\n| `%d`            | Day of month (zero-padded)                                                                                       |\n| `%a`            | Day of the week - short (Mon, Tue, Wed, Thu, Fri, Sat, Sun)                                                      |\n| `%A`            | Day of the week - long (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday)                          |\n| `%M`            | Month (zero-padded)                                                                                              |\n| `%b`            | Month - short (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec)                                       |\n| `%B`            | Month - Long (January, February, March, April, May, June, July, August, September, October, November, December)  |\n| `%y`            | Year - Two digit (13, 14 etc)                                                                                    |\n| `%Y`            | Year - Four digit (2013, 2014 etc)                                                                               |\n| `%h`            | Hour (12-hour format)                                                                                            |\n| `%H`            | Hour (24-hour format)                                                                                            |\n| `%m`            | Minute (zero-padded)                                                                                             |\n| `%s`            | Second (zero-padded)                                                                                             |\n| `%g`            | Subsecond part (precision is configured by ConfigurationType::SubsecondPrecision)                               |\n| `%F`            | AM/PM designation                                                                                                |\n| `%`             | Escape character                                                                                                 |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdoco%2Feasylog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdoco%2Feasylog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdoco%2Feasylog/lists"}