{"id":16537753,"url":"https://github.com/pablolec/livelog","last_synced_at":"2025-10-28T14:30:53.715Z","repository":{"id":43397921,"uuid":"411232656","full_name":"PabloLec/livelog","owner":"PabloLec","description":"Python logger and live reader","archived":false,"fork":false,"pushed_at":"2023-04-14T17:05:29.000Z","size":377,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T15:22:20.835Z","etag":null,"topics":["cli","console","cui","debugging","events","linux","log","logger","logging","logging-library","logs","macos","print","python","terminal","tui","utility","windows"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PabloLec.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":"2021-09-28T10:18:15.000Z","updated_at":"2024-11-22T06:01:25.000Z","dependencies_parsed_at":"2023-01-21T11:30:49.383Z","dependency_job_id":null,"html_url":"https://github.com/PabloLec/livelog","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PabloLec%2Flivelog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PabloLec%2Flivelog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PabloLec%2Flivelog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PabloLec%2Flivelog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PabloLec","download_url":"https://codeload.github.com/PabloLec/livelog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238662752,"owners_count":19509664,"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":["cli","console","cui","debugging","events","linux","log","logger","logging","logging-library","logs","macos","print","python","terminal","tui","utility","windows"],"created_at":"2024-10-11T18:43:21.864Z","updated_at":"2025-10-28T14:30:53.381Z","avatar_url":"https://github.com/PabloLec.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cdiv align=\"center\"\u003e\n\n\u003ch1\u003elivelog\u003c/h1\u003e\n\n\u003ca href=\"https://img.shields.io/github/v/release/pablolec/livelog\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/v/release/pablolec/livelog\" alt=\"Release\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/PabloLec/livelog/blob/main/LICENSE\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/pablolec/livelog\" alt=\"License\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/PabloLec/livelog/actions/workflows/linux-tests.yml\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://github.com/PabloLec/livelog/actions/workflows/linux-tests.yml/badge.svg\" alt=\"Linux\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/PabloLec/livelog/actions/workflows/macos-tests.yml\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://github.com/PabloLec/livelog/actions/workflows/macos-tests.yml/badge.svg\" alt=\"macOS\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/PabloLec/livelog/actions/workflows/windows-tests.yml\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://github.com/PabloLec/livelog/actions/workflows/windows-tests.yml/badge.svg\" alt=\"Windows\"\u003e\n\u003c/a\u003e\n\n\u003c/div\u003e\n\n---\n\n`livelog` is yet another Python logger.\n\nIts main purpose is to provide live logging for situation where logging to console is not possible. For example working on a GUI, TUI, a software plugin or a script instanciated from a different shell.\n\nIt provides a `Logger` object for your code and a built-in reader to see your logs in real time from another shell.\nEven if its overall behavior is opinionated it does offer some customization.\n\n## Demo\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"docs/assets/demo.gif\"\u003e\n\u003c/p\u003e\n\n\n## Installation\n\n```\npython3 -m pip install livelog\n```\n\n## Logging\n\n#### Basics\n\nIn your code, create a `Logger` instance with:\n\n``` python\nfrom livelog import Logger\n\nlogger = Logger()\n```\n\n#### Parameters\n\n`Logger` takes multiple optional arguments:\n\n- `file` (str): Path for your logging file. Default is a file named \"livelog.log\" in your system tmp directory.\n- `level` (str): Minimum level to be logged. Default is \"DEBUG\", you can also select \"INFO\", \"WARNING\", and \"ERROR\". Note that level filtering can also be done directly from the reader.\n- `enabled` (bool): Whether logging is enabled or not. Default is True.\n- `erase` (bool): Whether preexisting logging file should be erased or not. Default is True.\n\n``` python\nfrom livelog import Logger\n\nlogger = Logger(file= \"/home/user/\",\n                level = \"INFO\",\n                enabled = False,\n                erase = False)\n```\n\n#### Methods\n\nUse the following methods to write log messages:\n\n- `logger.debug(\"message\")`\n- `logger.info(\"message\")`\n- `logger.warn(\"message\")`\n- `logger.error(\"message\")`\n\n``` python\nfrom livelog import Logger\n\nlogger = Logger()\nlogger.debug(\"This is a debug message\")\nlogger.info(\"This is an info message\")\nlogger.warn(\"This is a warning message\")\nlogger.error(\"This is an error message\")\n```\n\n#### Attributes\n\nYou can get and set attributes after instantiation:\n\n``` python\nfrom livelog import Logger\n\nlogger = Logger(file=\"/tmp/file.log\")\nlogger.debug(\"This will write to /tmp/file.log\")\n\nlogger.file = \"/tmp/another_file.log\"\nlogger.debug(\"This will write to /tmp/another_file.log\")\n\nlogger.level = \"ERROR\"\nlogger.debug(\"This debug message will not be written.\")\n\nlogger.enabled = False\nlogger.error(\"Logging disabled. This error message will not be written.\")\n```\n\n#### Singleton\n\n`livelog` also provides a built-in singleton:\n\n```your_first_file.py```\n``` python\nfrom livelog import LoggerSingleton\n\n\nlogger = LoggerSingleton(file=\"/tmp/file.log\")\nlogger.debug(\"This will write to /tmp/file.log\")\n```\n\n```another_file.py```\n``` python\nfrom livelog import LoggerSingleton\n\n\nlogger = LoggerSingleton()\n# LoggerSingleton() returned the instance from your first file.\nlogger.debug(\"This will write to /tmp/file.log\")\n```\n\n## Reading\n\nAlthough you can access to your logging file like any other, you can use the provided reader.\n\nIf you did not specify a file for `Logger` simply use:\n```\npython3 -m livelog\n```\n\n`livelog` will read in real time the default log file.\n\n#### Options\n\n- `-f` or `--file` - Set the path of your logging file\n- `-l` or `--level` - Set the minimum log level to be read.\n- `--nocolors` - Do not print colors\n\n*Example:*\n```\npython3 -m livelog -f /tmp/myfile.log -l INFO --nocolors\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpablolec%2Flivelog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpablolec%2Flivelog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpablolec%2Flivelog/lists"}