{"id":19319399,"url":"https://github.com/zubairehman/flogs","last_synced_at":"2025-04-05T22:11:18.948Z","repository":{"id":34847706,"uuid":"184599060","full_name":"zubairehman/Flogs","owner":"zubairehman","description":"An Advanced Logging Framework develop in flutter that provides quick \u0026 simple logging solution.","archived":false,"fork":false,"pushed_at":"2024-05-17T07:13:15.000Z","size":480,"stargazers_count":199,"open_issues_count":39,"forks_count":91,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-29T21:08:01.362Z","etag":null,"topics":["dart","dart-library","dart-package","filing","flutter","flutter-app","flutter-example","flutter-package","logger","logging","logging-framework","logging-library","logs","package","sembast"],"latest_commit_sha":null,"homepage":"","language":"Dart","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/zubairehman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-05-02T14:48:44.000Z","updated_at":"2025-02-11T21:34:35.000Z","dependencies_parsed_at":"2024-06-18T18:15:39.313Z","dependency_job_id":"82726f2f-815a-49f2-94ac-f1d9af7565ca","html_url":"https://github.com/zubairehman/Flogs","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/zubairehman%2FFlogs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zubairehman%2FFlogs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zubairehman%2FFlogs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zubairehman%2FFlogs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zubairehman","download_url":"https://codeload.github.com/zubairehman/Flogs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406111,"owners_count":20933806,"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":["dart","dart-library","dart-package","filing","flutter","flutter-app","flutter-example","flutter-package","logger","logging","logging-framework","logging-library","logs","package","sembast"],"created_at":"2024-11-10T01:23:33.855Z","updated_at":"2025-04-05T22:11:18.926Z","avatar_url":"https://github.com/zubairehman.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"![banner](https://github.com/zubairehman/Flogs/blob/master/images/flogs-banner.png)\n\n# FLogs Advance Logging Framework\n\nFLog is an Advanced Logging Framework develop in flutter that provides quick \u0026 simple logging solution. All logs are saved to the DB which can then be exported as a zip file.\n\nOverview\n--------\n\nFLogs is written in dart. It basically features two types of loggers (FLog \u0026 DataLog) with many of advanced features needed for logging. Logs are saved in database which can then be exported in document directory of Android|iOS device. The logs are helpful when developer wants to analyze user activities within the app. These logs can be filtered and sorted easily. Logs can easily be exported as zip file base on filter type, the zip file can then be uploaded to server or to use it locally. \n\nMany times we want to log set of data to analyze certain activity e.g. Location (GPS Coordinates), Device info, Network requests etc. this helps us to quickly identify and fix the issue that is hard to debug when the app is in production. FLogs provide such functionality to log data set into database. These logs can then be fetched by applying different convinience filters availale.\n\nFeatures\n--------\n\n1. Logs events in files created separately every hour with **'FLogs'** logger. (24 hours)\n2. Files can be compressed and exported for time and day filters\n3. Clear Logs easily\n4. Save logs to custom path (Supported in Android only)\n5. Export Logs to custom path as zip file (Supported in Android only)\n6. Custom Log formatting\n7. CSV support\n8. Custom timestamps support\n9. Custom data logging support with **'DataLogs'** logger.\n10. Encryption support added\n11. Multiple directory structures\n12. Print logs as String\n13. Export all or single types of logs\n14. Advanced Automation for deleting logs automatically\n15. Exports HTML formatted exceptions\n16. Log level support\n                \nUse this package as a library\n-----------------------------\n\n**1. Depend on it**\n\nAdd this to your package's pubspec.yaml file:\n\n```\ndependencies:\n  f_logs: ^1.0.x\n```\n\n**2. Install it**\n\nYou can install packages from the command line:\n\nwith Flutter\n\n```\n$ flutter packages get\n```\n\nAlternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.\n\n**3. Import it**\n\nNow in your Dart code, you can use:\n\n```\nimport 'package:f_logs/f_logs.dart';\n```\n\nHow to use\n----------\n\nLog files are exported on storage directory so it's very important to add these permissions to your project's manifest file first.\n\n**Android**\n```\n\u003cuses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/\u003e\n\u003cuses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/\u003e\n```\n**iOS**\n```\n\u003ckey\u003eNSPhotoLibraryAddUsageDescription\u003c/key\u003e\n\u003cstring\u003eFLogs would like to save photos from the app to your gallery\u003c/string\u003e\n\u003ckey\u003eNSPhotoLibraryUsageDescription\u003c/key\u003e\n\u003cstring\u003eFLogs would like to access your photo gallery for uploading images to the app\u003c/string\u003e\n```\n\nTo save logs, simply call any of the method mentioned below:\n\n**1. Simple Trace Log**\n\n```dart \n    FLog.trace(\n      className: \"HomePage\",\n      methodName: \"_buildRow1\",\n      text: \"My log\");\n```\n\n**2. Simple Debug Log**\n\n```dart \n    FLog.debug(\n      className: \"HomePage\",\n      methodName: \"_buildRow1\",\n      text: \"My log\");\n```\n\n**3. Simple Info Log**\n\n```dart \n    FLog.info(\n      className: \"HomePage\",\n      methodName: \"_buildRow1\",\n      text: \"My log\");\n```\n\n**4. Simple Warning Log**\n\n```dart \n    FLog.warning(\n      className: \"HomePage\",\n      methodName: \"_buildRow1\",\n      text: \"My log\";\n```\n\n**5. Simple Error Log**\n\n```dart \n    FLog.error(\n      className: \"HomePage\",\n      methodName: \"_buildRow1\",\n      text: \"My log\");\n```\n\n**6. Simple Severe Log**\n\n```dart \n    FLog.severe(\n      className: \"HomePage\",\n      methodName: \"_buildRow1\",\n      text: \"My log\");\n```\n\n**7. Severe Log with Exception and StackTrace**\n\n```dart \n    FLog.logThis(\n      className: \"HomePage\",\n      methodName: \"_buildRow1\",\n      text: \"My log\",\n      type: LogLevel.SEVERE, \n      exception: Exception(\"This is an Exception!\"),\n      stacktrace: StackTrace.current);\n```\n\n**8. Simple Fatal Log**\n\n```dart \n    FLog.fatal(\n      className: \"HomePage\",\n      methodName: \"_buildRow1\",\n      text: \"My log\");\n```\n\n**9. Data Type Log**\n\n```dart \n    FLog.logThis(\n      className: \"HomePage\",\n      methodName: \"_buildRow1\",\n      text: \"My log\",\n      type: LogLevel.SEVERE,\n      dataLogType: DataLogType.DEVICE.toString());\n```\n\nAvailable Methods\n-----------------\nFLogs provide many convenience methods to save logs into or to fetch them from database, below is the list of all the methods available:\n\n**1. logThis**\n\nLogs string data along with className, methodName, logText and the type of log (LogLevel.SEVERE, LogLevel.INFO) etc. The same method can be used to log exception(s) or data logs. The difference between FLog and DataLogs is described above, you can also check out wiki for more details. If either className or methodName is not provided, it will automatically be taken by getting calling class and method.\n\n```dart \nstatic logThis({\n    String className, // This is optional if not provided, then it will automatically be taken by getting calling class\n    String methodName, // This is optional if not provided, then it will automatically be taken by getting calling method\n    @required String text,\n    @required LogLevel type,\n    Exception exception,\n    String dataLogType,\n    StackTrace stacktrace,\n}){}\n```\n\n**2. trace**\n\nLogs string data along with className, methodName, logText and the type of log (LogLevel.SEVERE, LogLevel.INFO) etc. The same method can be used to log exception(s) or data logs. If either className or methodName is not provided, it will automatically be taken by getting calling class and method.\n\n```dart \nstatic trace({\n    String className, // This is optional if not provided, then it will automatically be taken by getting calling class\n    String methodName, // This is optional if not provided, then it will automatically be taken by getting calling method\n    @required String text,\n    Exception exception,\n    String dataLogType,\n    StackTrace stacktrace,\n}){}\n```\n\n**3. debug**\n\nLogs string data along with className, methodName, logText and the type of log (LogLevel.SEVERE, LogLevel.INFO) etc. The same method can be used to log exception(s) or data logs. If either className or methodName is not provided, it will automatically be taken by getting calling class and method.\n\n```dart \nstatic debug({\n    String className, // This is optional if not provided, then it will automatically be taken by getting calling class\n    String methodName, // This is optional if not provided, then it will automatically be taken by getting calling method\n    @required String text,\n    Exception exception,\n    String dataLogType,\n    StackTrace stacktrace,\n}){}\n```\n\n**4. info**\n\nLogs string data along with className, methodName, logText and the type of log (LogLevel.SEVERE, LogLevel.INFO) etc. The same method can be used to log exception(s) or data logs. If either className or methodName is not provided, it will automatically be taken by getting calling class and method.\n\n```dart \nstatic info({\n    String className, // This is optional if not provided, then it will automatically be taken by getting calling class\n    String methodName, // This is optional if not provided, then it will automatically be taken by getting calling method\n    @required String text,\n    Exception exception,\n    String dataLogType,\n    StackTrace stacktrace,\n}){}\n```\n\n**5. warning**\n\nLogs string data along with className, methodName, logText and the type of log (LogLevel.SEVERE, LogLevel.INFO) etc. The same method can be used to log exception(s) or data logs. If either className or methodName is not provided, it will automatically be taken by getting calling class and method.\n\n```dart \nstatic warning({\n    String className, // This is optional if not provided, then it will automatically be taken by getting calling class\n    String methodName, // This is optional if not provided, then it will automatically be taken by getting calling method\n    @required String text,\n    Exception exception,\n    String dataLogType,\n    StackTrace stacktrace,\n}){}\n\n```\n\n**6. error**\n\nLogs string data along with className, methodName, logText and the type of log (LogLevel.SEVERE, LogLevel.INFO) etc. The same method can be used to log exception(s) or data logs. If either className or methodName is not provided, it will automatically be taken by getting calling class and method.\n\n```dart \nstatic error({\n    String className, // This is optional if not provided, then it will automatically be taken by getting calling class\n    String methodName, // This is optional if not provided, then it will automatically be taken by getting calling method\n    @required String text,\n    Exception exception,\n    String dataLogType,\n    StackTrace stacktrace,\n}){}\n\n```\n\n**7. severe**\n\nLogs string data along with className, methodName, logText and the type of log (LogLevel.SEVERE, LogLevel.INFO) etc. The same method can be used to log exception(s) or data logs. If either className or methodName is not provided, it will automatically be taken by getting calling class and method.\n\n```dart \nstatic severe({\n    String className, // This is optional if not provided, then it will automatically be taken by getting calling class\n    String methodName, // This is optional if not provided, then it will automatically be taken by getting calling method\n    @required String text,\n    Exception exception,\n    String dataLogType,\n    StackTrace stacktrace,\n}){}\n\n```\n\n**8. fatal**\n\nLogs string data along with className, methodName, logText and the type of log (LogLevel.SEVERE, LogLevel.INFO) etc. The same method can be used to log exception(s) or data logs. If either className or methodName is not provided, it will automatically be taken by getting calling class and method.\n\n```dart \nstatic fatal({\n    String className, // This is optional if not provided, then it will automatically be taken by getting calling class\n    String methodName, // This is optional if not provided, then it will automatically be taken by getting calling method\n    @required String text,\n    Exception exception,\n    String dataLogType,\n    StackTrace stacktrace,\n}){}\n\n```\n\n**9. printLogs**\n\nFetches all the logs from database and prints them as a string using StringBuffer()\n\n```dart \nstatic printLogs() async {}\n```\n\n**10. getAllLogsByCustomFilter**\n\nAccepts list of filters as an arguments and returns list of logs based on the provided filters. The use of Filters with their usage is explained in wiki, please checkout wiki for more details.\n\n```dart \nList\u003cFilter\u003e filters = [Filter.greaterThan('[FieldName]', '[Value]')]\n\nstatic Future\u003cList\u003cLog\u003e\u003e getAllLogsByCustomFilter(\n    {List\u003cFilter\u003e filters}) async {}\n```\n\n**11. getAllLogsByFilter**\n\nA convenience method that filters data based on the provided filter params e.g. dataLogsType (DataLogType.DEVICE,  DataLogType.NETWORK), logLevels(LogLevel.SEVERE, LogLevel.INFO), startTimeInMillis (millisec of the day you from where you want logs to be fetched), endTimeInMillis (milisec of the day you till you want logs to be fetched) and filterType (FilterType.LAST_HOUR, FilterType.LAST_24_HOURS, FilterType.TODAY, FilterType.WEEK, FilterType.ALL). Filter type can't be used with `startTimeInMillis`, `endTimeInMillis`, if so the priority will be given to `startTimeInMillis`, `endTimeInMillis`. In-order to have full control over filters, use method provided above.\n\n```dart \nstatic Future\u003cList\u003cLog\u003e\u003e getAllLogsByFilter(\n    {List\u003cString\u003e dataLogsType,\n    List\u003cString\u003e logLevels,\n    int startTimeInMillis,\n    int endTimeInMillis,\n    FilterType filterType}}) async {}\n```\n\n**12. getAllLogs**\n\nFetches all the logs from database and returns a list of logs.\n\n```dart \nstatic Future\u003cList\u003cLog\u003e\u003e getAllLogs() async {}\n```\n\n**13. exportLogs**\n\nExports logs to external storage under FLog directory.\n\n```dart \nstatic exportLogs() async {}\n```\n\n**14. clearLogs**\n\nClears all the logs stored in database.\n\n```dart \nstatic clearLogs() {}\n```\n\n**15. applyConfigurations**\n\nApply user provided configurations to FLogs.\n\n```dart \nstatic applyConfigurations(LogsConfig config) {}\n```\n\n**16. deleteAllLogsByFilter**\n\nAccepts list of filters as an arguments and delete logs based on the provided filters. The use of Filters with their usage is explained in wiki, please checkout wiki for more details.\n\n```dart \nList\u003cFilter\u003e filters = [Filter.greaterThan('[FieldName]', '[Value]')]\n\nstatic deleteAllLogsByFilter(\n    {List\u003cFilter\u003e filters}) async {}\n```\n\nWiki\n----\n\nCheckout [wiki](https://github.com/zubairehman/Flogs/wiki) for more info\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzubairehman%2Fflogs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzubairehman%2Fflogs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzubairehman%2Fflogs/lists"}