{"id":19174043,"url":"https://github.com/onezens/yclog","last_synced_at":"2025-05-07T18:10:42.570Z","repository":{"id":166687739,"uuid":"120746155","full_name":"onezens/YCLog","owner":"onezens","description":"iOS 轻量级彩色终端日志系统","archived":false,"fork":false,"pushed_at":"2024-11-26T10:45:24.000Z","size":280,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T19:41:30.072Z","etag":null,"topics":["colorlogger","console-log","ios","log","logger"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/onezens.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-02-08T10:23:05.000Z","updated_at":"2024-11-26T10:45:27.000Z","dependencies_parsed_at":"2024-11-26T11:40:29.311Z","dependency_job_id":null,"html_url":"https://github.com/onezens/YCLog","commit_stats":null,"previous_names":["onezens/yclog"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onezens%2FYCLog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onezens%2FYCLog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onezens%2FYCLog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onezens%2FYCLog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onezens","download_url":"https://codeload.github.com/onezens/YCLog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252931555,"owners_count":21827112,"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":["colorlogger","console-log","ios","log","logger"],"created_at":"2024-11-09T10:15:47.101Z","updated_at":"2025-05-07T18:10:42.542Z","avatar_url":"https://github.com/onezens.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YCLog\niOS 轻量级彩色终端日志系统。采用了BS架构设计，包含了日志服务端和日志客户端，客户端日志可以集成到APP项目中，服务端日志需要手动编译和安装\n\n## 优点\n\n1、Xcode 日志查看不方便，过滤功能比较薄弱。YCLogConsole 提供了丰富的过滤功能\n\n2、每次运行的日志会保存在沙盒，便于问题复现，也可本地查看日志（less、tail等）\n\n3、Xcode、Console 长日志会显示不全，YCLogConsole 不存在该问题\n\n4、Xcode 或者系统的 Console 特殊场景下会丢失日志，YCLogConsole 不存在该问题\n\n5、可定制化能力高，一键屏蔽无用日志，沉浸式查看日志\n\n## 安装服务端\n\n下载源码，编译 YCLogConsole 为二进制可执行文件，然后把他放到 /usr/local/bin/ 路径下，或者其他的 $PATH 路径里面。最后在终端执行 YCLogConsole 命令，启动日志服务端。\n\n```\n# 显示所有日志\n$ YCLogConsole\n\n# 只展示包含 debug 或 info关键字的日志\n$ YCLogConsole -f debug info\n\n# 只展示包含 debug 且 info关键字的日志\n$ YCLogConsole -f 'debug\u0026info'\n\n# 不展示包含 debug 或 info关键字的日志\n$ YCLogConsole -b debug info\n\n# 根据设备标识，查看日志。需要在日志客户端设置设备标识\n$ YCLogConsole -d 81201006352934AC0201\n\n# 指定日志标识，启动日志\n$ YCLogConsole -n DDLogSrv\n```\n\n## 客户端使用日志\n\n```\nYCLogConfig *config = [YCLogConfig new];\nconfig.localLogPath = [self logPath]; // 指定本地存储日志路径\nconfig.logHost = @\"192.168.2.2\"; // 日志服务端的IP地址，需要确保局域网内可互相访问到\nconfig.deviceId = @\"81201006352934AC0201\";  // 指定设备标识、如果同一局域网有多个用户使用时，推荐指定设备标识\n[[YCLog shared] setup:config];\n\n```\n\n## 打印日志\n\n```\n- (void)touchesBegan:(NSSet\u003cUITouch *\u003e *)touches withEvent:(UIEvent *)event \n{\n    YCLogError(@\"error\");\n    YCLogWarn(@\"warn\");\n    YCLogInfo(@\"info\");\n    YCLogDebug(@\"debug\");\n    [self sendRequest];\n}\n\n- (void)sendRequest\n{\n    NSURLSession *session = [NSURLSession sharedSession];\n    NSURLSessionDataTask *task = [session dataTaskWithURL:[NSURL URLWithString:@\"http://api.onezen.cc/v1/video/list?page=1\u0026size=1\"] completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {\n        if (error) {\n            YCLogError(@\"[sendRequest] error: %@\",error);\n            return;\n        }\n        id obj = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];\n        YCLogInfo(@\"[sendRequest] success result: %@\", obj);\n    }];\n    [task resume];\n}\n\n```\n\n## Terminal 展示效果\n![https://github.com/onezens/StorageCenter/blob/main/images/yclog.png?raw=true\n](https://github.com/onezens/StorageCenter/blob/main/images/yclog.png?raw=true)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonezens%2Fyclog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonezens%2Fyclog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonezens%2Fyclog/lists"}