{"id":13700159,"url":"https://github.com/shukean/php-yklogger","last_synced_at":"2025-05-04T18:34:25.635Z","repository":{"id":32531429,"uuid":"36113089","full_name":"shukean/php-yklogger","owner":"shukean","description":"A php log extension.","archived":false,"fork":false,"pushed_at":"2019-01-11T07:30:36.000Z","size":45,"stargazers_count":4,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-13T06:33:06.802Z","etag":null,"topics":[],"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/shukean.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}},"created_at":"2015-05-23T07:56:11.000Z","updated_at":"2020-12-25T08:21:21.000Z","dependencies_parsed_at":"2022-09-09T20:53:05.675Z","dependency_job_id":null,"html_url":"https://github.com/shukean/php-yklogger","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/shukean%2Fphp-yklogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shukean%2Fphp-yklogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shukean%2Fphp-yklogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shukean%2Fphp-yklogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shukean","download_url":"https://codeload.github.com/shukean/php-yklogger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252382992,"owners_count":21739256,"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":[],"created_at":"2024-08-02T20:00:49.169Z","updated_at":"2025-05-04T18:34:20.612Z","avatar_url":"https://github.com/shukean.png","language":"C","funding_links":[],"categories":["日志"],"sub_categories":[],"readme":"# php- YkLogger\nphp日志记录扩展. 共有5种级别. 分为:  debug,  info(trace), warn, error, fatal.  \n(php7 版本)\n\n## install\nmac or linux:  \n1.  wget https://github.com/shukean/php-yklogger.git\n2.  unzip master.php  \n3.  phpize  \n4.  ./configure --with-php-config=your_php_path/php-config  \n5.  make \u0026\u0026 make install  \n\n## php.ini\n```\n[YkLogger]\nykgogger.auto_flush_num = 50  \n```\n达到多少条日志时, 才开始写入文件.  \n当request 结束时, 也会写入.  \n\n## init\n```\ndate_default_timezone_set('Etc/GMT-8');  \n YkLogger::init([  \n    'logFile' =\u003e path,  \n    'logLevel' =\u003e level  \n]);  \n```\n\u003e path 为日志存放目录.  \n\u003e level 为日志级别. 低于级别的方法调用不会写入日志.  日志级别定义的有常量, 分别为:  \n\n1.YKLOGGER_LEVEL_DEBUG  \n2.YKLOGGER_LEVEL_INFO  \n3.YKLOGGER_LEVEL_WARN  \n4.YKLOGGER_LEVEL_ERROR  \n5.YKLOGGER_LEVEL_FATAL  \n\n## methods\n```\nYkLogger::debug(string $message, uint $errno = 0, arary $params = []);  \nYkLogger::info(string $message, uint $errno = 0 , arary $params = []); //  YkLogger::trace 是info的别名  \nYkLogger::warn(string $message, uint $errno = 0, arary $params = []);  \nYkLogger::error(string $message, uint $errno = 0, arary $params = []);  \nYkLogger::fatal(string $message, uint $errno = 0, arary $params = []);  \n```\n\n## methods argument\n$message  日志描述  \n$errno    错误码  \n$params   需要记录的其他字段信息, 二维数组将会转为json存入  \n\n## other methods\n YkLogger::resetRequestTime(uint timestamp = 0); //  YkLogger::reset_request_time 是resetRequestTime的别名  \n重置初始化的时间  \n\nstring $request_id =  YkLogger::getRequestId(); //  YkLogger::get_request_id 是getRequestId的别名  \n获取本次request的随机ID, 不保证不会重复  \n\n## log file\netc: api.2015052314   api.wf.2015052314  \nwf 为 warn error  fatal 的日志, 日志按小时划分.  \nlogFile 最后一个斜线的字符为日志文件的前缀.  \n\n\n## log content\n级别 时间 [文件:行数] [php进程号] reqip[IP] uri[uri] refer[url] cost[耗时] errno[0]  params message  \nparams 会按照 [key] value 的方式连接.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshukean%2Fphp-yklogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshukean%2Fphp-yklogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshukean%2Fphp-yklogger/lists"}