{"id":22157690,"url":"https://github.com/pwrdc/logpy","last_synced_at":"2026-06-16T23:32:05.734Z","repository":{"id":125831277,"uuid":"148016291","full_name":"pwrdc/LogPy","owner":"pwrdc","description":"Versatile Python Logger ","archived":false,"fork":false,"pushed_at":"2019-03-12T11:20:30.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-28T01:40:52.133Z","etag":null,"topics":["logger","logging","python","python3","threading"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/pwrdc.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-09-09T10:50:23.000Z","updated_at":"2019-11-04T11:37:53.000Z","dependencies_parsed_at":"2023-07-17T04:16:07.054Z","dependency_job_id":null,"html_url":"https://github.com/pwrdc/LogPy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pwrdc/LogPy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwrdc%2FLogPy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwrdc%2FLogPy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwrdc%2FLogPy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwrdc%2FLogPy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pwrdc","download_url":"https://codeload.github.com/pwrdc/LogPy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwrdc%2FLogPy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34428196,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-16T02:00:06.860Z","response_time":126,"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":["logger","logging","python","python3","threading"],"created_at":"2024-12-02T03:12:47.472Z","updated_at":"2026-06-16T23:32:05.718Z","avatar_url":"https://github.com/pwrdc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LogPy Logger - the versatile Python Logger\n\nThis module offers universal logging solution for software development, taking into considerations things such as logfile title, managing existing logfiles, changing working directories, 4 log types, adjustable timestamp and log with pre- and postfixes.\n\nIt is also supplied with multithreading opportunity, using Events and Exception handling.\n\n## Usage\nTo use the LogPy, clone the repository into your directory using Git:\n\n```console\n$ git clone https://github.com/PiotrJZielinski/LogPy\n```\n\nYou can then (assuming you put LogPy module in your working directory) import it into your project using:\n\n```python\nfrom LogPy.LogPy import Logger\n```\n\nYou might as well install the package using pip:\n\n```\npip install git+https://github.com/PiotrJZielinski/LogPy\n```\n\n### Initialization\n\nThe class is initialized with parameters:\n\n```python\nLogger(filename='main', directory='', logtype='info', timestamp='%Y-%m-%d | %H:%M:%S.%f', logformat='[{timestamp}] {logtype}:   {message}', prefix='', postfix='', title='Main Logger', logexists='append', console=False):\n```\n\nwhere:\n* `filename` is the name of the file in which you intend to put the log in;\n* `directory` is the directory in which you want to put the file; leaving it default puts the file in your working directory;\n* `logtype` is the default log message to use (one of: *info*, *warning*, *error*, *fatal*);\n* `timestamp` is the string used for defining (see datetime.strftime() for timestamp formatting details);\n* `logformat` is the log configuration (string containing variables: *timestamp*, *logtype*, *message*, *prefix*, *postfix*)\n* `prefix`\n* `postfix`\n* `title` is the string to be put on the top of the logfile\n* `logexists` is the default action to be performed in case logfile already exists (*append*, *overwrite* or *rename*)\n* `console` is a boolean specifying whether the logger should print messages in the console\n* `external_function` is a reference to function that returns string message for log\n* `internal_logger_time` delay between external function calls\n\nYou can change most of these parameters during the operation of the program using property setters supplied in the module\n\nMethods such as *clear*, *delete*, *pause* and *resume* are to perform as they are named. They are provided with security checks and necessary features.\n\n### Logging\n\nFor logging use the method\n\n```python\nlog(msg, logtype=''):\n```\n\nwhere:\n* `msg` is the message to be put in the logfile\n* `logtype` is the log details put before the message (one of the available) - defaults to the type defined in the initialization\n\nLogging with a message starting with an exclamation mark (*'!'*) will disable all information, putting just the message in the row.\n\n### Periodic logging\nIf you assign a reference to class to *external_function*, internal thread calls it at regullar intervals. Size of the intervals equals `internal_logger_time` value\n\n### Running\n\nThe class is designed for running as a separate thread, which would provide exception catching for the log without interrupting main program execution and waiting for other instructions to execute. In order to take advantage of the threading use similar code:\n\n```python\nfrom threading import Thread\n\nfrom LogPy.LogPy import Logger\n\nlogger = Logger()\nlogger_thread = Thread(target=logger.run, name='My Logger')\nlogger_thread.start()\n```\n\nAlternative method for starting logger thread - call start method:\n```python\nlogger = Logger()\nlogger.start()\n```\n\nFrom then on the thread will be running. To log something use the aforemention `log` method.\n\nIn order to stop the logger from running (ie. at the end of your program) you have to set an exit flag. To do so simply type:\n\n```python\nlogger.exit()\n```\n\nwhich will interrupt thread execution, terminating it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpwrdc%2Flogpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpwrdc%2Flogpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpwrdc%2Flogpy/lists"}