{"id":37028216,"url":"https://github.com/android-module/android-logger","last_synced_at":"2026-01-14T03:21:55.878Z","repository":{"id":61794511,"uuid":"522364890","full_name":"android-module/android-logger","owner":"android-module","description":"Websocket日志打印","archived":false,"fork":false,"pushed_at":"2022-10-27T02:18:34.000Z","size":180,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-07-28T10:08:42.119Z","etag":null,"topics":["kotlin-android","socket","websocket"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/android-module.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}},"created_at":"2022-08-08T01:10:09.000Z","updated_at":"2023-07-16T08:39:23.000Z","dependencies_parsed_at":"2023-01-20T17:46:41.198Z","dependency_job_id":null,"html_url":"https://github.com/android-module/android-logger","commit_stats":null,"previous_names":[],"tags_count":2,"template":null,"template_full_name":null,"purl":"pkg:github/android-module/android-logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/android-module%2Fandroid-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/android-module%2Fandroid-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/android-module%2Fandroid-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/android-module%2Fandroid-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/android-module","download_url":"https://codeload.github.com/android-module/android-logger/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/android-module%2Fandroid-logger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408828,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["kotlin-android","socket","websocket"],"created_at":"2026-01-14T03:21:55.262Z","updated_at":"2026-01-14T03:21:55.863Z","avatar_url":"https://github.com/android-module.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"![main](https://github.com/android-module/android-logger/actions/workflows/android.yml/badge.svg?branch=main)\n[![API](https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat-square)](https://android-arsenal.com/api?level=21)\n![maven](https://img.shields.io/maven-central/v/io.github.caldremch/android-logger?style=flat-square)\n![core](https://img.shields.io/maven-central/v/io.github.caldremch/core-logger?style=flat-square)\n\n## 说明\n\n- 自动连接探测器(基于socket udp)\n- websocket日志传输器\n- 日志打印器\n\n## 功能\n\n1. 自动探测局域网并匹配服务\n2. 未连接时所打印的日志, 连接后一次性补打出来\n3. 自动依赖并开启探测,无需任何代码初始化处理, 也可以手动开关日志\n4. 探测端口目前最多支持10个设备(10个端口),被占用时自动使用下一个端口\n5. 客户端和服务端都是相互自动连接, 无需担心任何一段重启\n6. 自动监听应用前后台切换并恢复和暂停探测\n7. 简单的api使用方式\n\n## 使用建议\n\n建议接入方, 统一日志打印入口, 可以做到灵活切换打印方式, 较少耦合\n\n## 使用方式\n\n### 1. 在build.gradle中添加依赖\n\n也是提供了两种方式,分别对应两种依赖\n\n#### 1.1自动依赖(推荐)\n\n一个依赖完成所有初始化, 无需任何代码操作\n\n```gradle\nimplementation 'io.github.caldremch:android-logger:1.0.6-rc1'\n```\n\n#### 1.2手动依赖\n\n```gradle\nimplementation 'io.github.caldremch:core-logger:1.0.6-rc1'\n```\n\n需要手动调用初始化方法\n\n```kotlin\n\n//场景1.出api封装, 不会开启探测, 也不会触发日志发送到服务端\nDebugLogInitializer.initLite\n\n//场景2.开启探测和自动连接(推荐)\nDebugLogInitializer.initWithDetect\n\n```\n\n#### 2.方法调用\n\n**打印**\n\n```kotlin\ndebugLog { \"log printer debug\" }\nerrorLog { \"log printer error\" }\nerrorLog { \"https://baidu.com\" }\n```\n\n**开启或者关闭所有日志的打印**\n\n```kotlin\n// logEnable 关闭所有的日志打印, 如果要用在线上就设置logEnable 设置为false\nDebugLogInitializer.setEnable(logEnable: Boolean)\n```\n\n**暂停/恢复, 关闭/启动探测**\n\n暂停/恢复是针对生命周期控制行为, 短暂性的关闭\n关闭则是app声明周期内都不会再执行探测, 触发再次启动\n\n```kotlin\n//暂停探测\nDebugLogInitializer.pauseDetect()\n//恢复探测\nDebugLogInitializer.resumeDetect()\n//关闭探测\nDebugLogInitializer.shutDownNetLog()\n//启动探测\nDebugLogInitializer.setUpNetLog()\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandroid-module%2Fandroid-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandroid-module%2Fandroid-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandroid-module%2Fandroid-logger/lists"}