{"id":18009853,"url":"https://github.com/kaedea/b-log","last_synced_at":"2025-03-26T14:31:31.258Z","repository":{"id":81348827,"uuid":"79571630","full_name":"kaedea/b-log","owner":"kaedea","description":"BLog is not blog but an android logcat entended utility library. It helps to log message to file as well as print in logcat window.","archived":false,"fork":false,"pushed_at":"2017-04-15T11:05:51.000Z","size":173,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T23:22:05.117Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/kaedea.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":"2017-01-20T15:39:04.000Z","updated_at":"2022-11-01T13:32:14.000Z","dependencies_parsed_at":"2023-03-12T13:42:11.348Z","dependency_job_id":null,"html_url":"https://github.com/kaedea/b-log","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaedea%2Fb-log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaedea%2Fb-log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaedea%2Fb-log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaedea%2Fb-log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaedea","download_url":"https://codeload.github.com/kaedea/b-log/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245670725,"owners_count":20653410,"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-10-30T02:11:17.022Z","updated_at":"2025-03-26T14:31:31.252Z","avatar_url":"https://github.com/kaedea.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n## BLog - Android Log Extended Utility\n[中文](/README_CN.md)\n\u003cimg align=\"right\" src=\"https://img.shields.io/badge/minSdk-9-brightgreen.svg\"/\u003e\n\u003cimg align=\"right\" src=\"https://api.bintray.com/packages/kaedea/moe-studio/b-log/images/download.svg\" href = \"https://bintray.com/kaedea/moe-studio/b-log/_latestVersion\"/\u003e\n\u003cimg align=\"right\" src=\"https://img.shields.io/hexpm/l/plug.svg\"/\u003e\n\n\nBLog is an Android LogCat extended Utility. It can simplify the way you use\n{@link android.util.Log}, as well as write our log message into file for after support.\n\n**BLog is not pronounced 'Blog[blɒɡ]', but '[bi:lɒɡ]'.**\n\n\n### Feature\n 1. Simplified Api for logging message.\n 2. Print `Thread Info`.\n 3. Set `LogLevel` to control whether to print log or not.\n 4. Write log message to `file` in order to trace bugs from release app.\n\n**Though BLog support using LogLevel to control whether to print log message or\nnot, it is recommended to use `if statement with a constant as condition` to\ncontrol the Log Block as the following snippet.**\n\n```java\nif (BuildConfig.DEBUG) {\n  BLog.v(TAG, \"Log verbose\");\n}\n```\n\nPlease try `best performance` in any case. :)\n\n\n## Getting Started\n### Dependency \u0026 Initialization\nAdd dependency.\n```java\n    compile 'moe.studio:logger:latest.release'\n```\nInitialization.\n```java\nBLog.initialize(context);\n```\n\n### Basic\nPrint log message.\n```java\nBLog.v(TAG, \"log verbose\");\nBLog.v(\"log verbose with default tag\");\n\nBLog.d(TAG, \"log debug\");\nBLog.d(\"log debug with default tag\");\n\nBLog.i(TAG, \"log info\");\nBLog.i(\"log info with default tag\");\n\nBLog.w(TAG, \"log warning\");\nBLog.w(\"log warning with default tag\");\n\nBLog.e(TAG, \"log error\");\nBLog.e(\"log error with default tag\");\n\nBLog.wtf(TAG, \"log wtf\");\nBLog.wtf(\"log wtf with default tag\");\n```\n\nPrint event message.\n```java\nBLog.event(TAG, \"event A\");\nBLog.event(\"event B\");\nBLog.event(\"Excited!\");\n```\n\nGet log files.\n```java\n// Get log files;\nFile all = BLog.zippingLogFiles(LogSetting.LOG, null);\n// Get log \u0026 event files.\nFile all = BLog.zippingLogFiles(LogSetting.LOG | LogSetting.EVENT, null);\n\n// Get logs with addiction files.\nList\u003cFile\u003e attaches = new ArrayList\u003c\u003e();\nattaches.add(outDate1);\nattaches.add(outDate2);\nFile attach = BLog.zippingLogFiles(LogSetting.LOG | LogSetting.EVENT, attaches);\n```\n\n### Advanced\nPrint exception.\n```java\nException exception = new RuntimeException(\"...\");\n\nBLog.v(TAG, \"runtime exception\", exception);\nBLog.v(exception);\n```\n\nPrint String with format.\n```java\nBLog.vfmt(TAG, \"log %s with format string\", \"verbose\");\nBLog.dfmt(null, \"log %s with format string\", \"debug\");\nBLog.ifmt(TAG, \"log %s with format string\", \"info\");\nBLog.wfmt(null, \"log %s with format string\", \"warning\");\nBLog.efmt(TAG, \"log %s with format string\", \"error\");\nBLog.wtffmt(null, \"log %s with format string\", \"wtf\");\n```\n\nIn general, BLog uses a worker thread to write log messages into file. If you want to log message synchronously into file, you'd better use the following api.\n```java\nBLog.syncLog(LogPriority.VERBOSE, \"TEST\", \"Sync Log.\");\nBLog.syncLog(LogPriority.DEBUG, \"TEST\", \"Sync Log.\");\n```\n\nBesides, you can set a custom LogAdapter to do some addiction jobs when executing a log.\n```java\nLogSetting setting = new LogSetting.Builder(context)\n                .setAdapter(new Log() {\n                    @Override\n                    public void log(int priority, String tag, String msg) {\n                        // Do something.\n                    }\n\n                    @Override\n                    public void onShutdown() {\n                        // Do something.\n                    }\n                })\n                .build();\n\nBLog.initialize(setting);\n```\n\n### Custom Setting\nInitialize BLog\n```java\nBLog.initialize(Context);\n```\n\nInitialize BLog with custom setting\n```java\nLogSetting setting = new LogSetting.Builder(context)\n        .setDefaultTag(\"TEST\")\n        .setLogDir(logDir.getPath())\n        .setExpiredDay(1)\n        .setLogcatLevel(LogLevel.DEBUG)\n        .setLogfileLevel(LogLevel.INFO)\n        .setEventLevel(LogLevel.VERBOSE)\n        .setFormatter(new LogFormatterImpl())\n        .setAdapter(new Log())\n        .build();\n\nBLog.initialize(setting);\n```\n\nIn general, BLog will shutdown itself when the application is terminated, but you can use `BLog#shutdown()` to shutdown BLog.\n\nFor more usage showcases, please check out the [test codes](https://github.com/kaedea/b-log/tree/release/bintray/library/src/androidTest/java/moe/studio/log).\n\n## License\nLicensed under the Apache License, Version 2.0 (the \"License\").","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaedea%2Fb-log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaedea%2Fb-log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaedea%2Fb-log/lists"}