{"id":25235366,"url":"https://github.com/kunalgehlot/logez","last_synced_at":"2025-10-26T10:31:48.335Z","repository":{"id":53775876,"uuid":"521545834","full_name":"KunalGehlot/logEZ","owner":"KunalGehlot","description":"Make logging easy in your applications! Use this simple library to easily use logs in any of your applications.","archived":false,"fork":false,"pushed_at":"2023-04-30T12:18:28.000Z","size":42,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-10T17:43:54.452Z","etag":null,"topics":["python","python-logging","python3","pythonlibrarires"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/logEZ/","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/KunalGehlot.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.txt","contributing":"CONTRIBUTING.md","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-05T07:31:31.000Z","updated_at":"2023-04-06T08:59:41.000Z","dependencies_parsed_at":"2022-09-05T17:42:19.353Z","dependency_job_id":null,"html_url":"https://github.com/KunalGehlot/logEZ","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KunalGehlot%2FlogEZ","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KunalGehlot%2FlogEZ/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KunalGehlot%2FlogEZ/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KunalGehlot%2FlogEZ/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KunalGehlot","download_url":"https://codeload.github.com/KunalGehlot/logEZ/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238310583,"owners_count":19450892,"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":["python","python-logging","python3","pythonlibrarires"],"created_at":"2025-02-11T14:33:21.109Z","updated_at":"2025-10-26T10:31:48.014Z","avatar_url":"https://github.com/KunalGehlot.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# logEZ\n\nMake logging easy in your applications! Use this simple library to easily use logs in any of your applications.\n\n## Installation\n\n```bash\npip install logEZ\n```\n\n## How to use\n\n```python\nfrom logEZ import MyLogger\n\nlogger = MyLogger()\n```\n\nMore in [Sample App](./sample_app.md)\n\n### `MyLogger` class\n\nThe __init__ method of the MyLogger class takes four optional arguments:\n\n* `log_file_name`\n* `logging_level`\n* `disable_console_logs`\n* `disable_file_logs`\n\nThe default values are:\n\n```python\nlog_file_name=\"logEZ.log\",\nlogging_level=\"INFO\",\ndisable_console_logs=False,\ndisable_file_logs=False\n```\n\n* `log_file_name`: Specify the file name of your log file here.\n* `logging_level`: Specify the default logging level of your logs. It can be `INFO`, `DEBUG`, `WARNING`, `ERROR`, or `CRITICAL`.\n* `disable_console_logs`: Disable the console logging of your logs, if set to `True`.\n* `disable_file_logs`: Disable the file logging of your logs, if set to `True`.\n\n### `MyLogger` methods\n\nOnce you have initialized a MyLogger object, you can use the following methods:\n\n* `setLoggingLevel(level: str)`: Change the logging level after initializing `MyLogger()`. (Refer to logging_level under [`MyLogger` class](#mylogger-class) for levels.)\n* `debug(inString: str)`: Log a `DEBUG` level message. Accepts a string input.\n* `info(inString: str)`: Log an `INFO` level message. Accepts a string input.\n* `warning(inString: str)`: Log a `WARNING` level message. Accepts a string input.\n* `error(inString: str, exc_info: Optional[bool] = False)`: Log an `ERROR` level message. Accepts a string input. If `exc_info` is set to True, it appends the complete execution information along with the log string.\n* `critical(inString: str, exc_info: Optional[bool] = False)`: Log a `CRITICAL` level message. Accepts a string input. If `exc_info` is set to True, it appends the complete execution information along with the log string.\n\n#### Using `exc_info` to send complete execution information\n\nThe `exc_info` parameter is an optional argument available in the `error` and `critical` methods of the `MyLogger` class. When set to `True`, it appends the complete execution information, including the traceback, along with the log message. This can be particularly useful when debugging errors or critical issues that require detailed information about the context in which they occurred.\n\nHere's an example of how to use the `exc_info` parameter with myError and `critical` methods:\n\n```python\nfrom logEZ import MyLogger\n\nlogger = MyLogger()\n\ndef divide(a, b):\n    try:\n        result = a / b\n    except ZeroDivisionError as e:\n        logger.myError(f\"An error occurred while dividing {a} by {b}\", exc_info=True)\n        return None\n    return result\n\ndivide(10, 0)\n```\n\nIn this example, we have a `divide` function that takes two numbers as arguments and attempts to perform a division operation. If a `ZeroDivisionError` exception is raised, the `error` method is called with the `exc_info` parameter set to `True`. This will log the error message along with the complete execution information, including the traceback, making it easier to understand the context in which the error occurred.\n\nThe output of this code will be:\n\n```bash\n01-04-23 14:35:28 - root : ERROR : An error occurred while dividing 10 by 0\nTraceback (most recent call last):\n  File \"example.py\", line 7, in divide\n    result = a / b\nZeroDivisionError: division by zero\n```\n\nSimilarly, you can use the `exc_info` parameter with the `critical` method if you want to log critical messages with complete execution information.\n\n## Why use logEZ?\n\nThe logEZ library provides a simplified interface to work with the standard logging module in Python. While it does not introduce any new functionality or significant improvements over the built-in logging module, it may be helpful for developers who want a more straightforward, easy-to-use API for common logging tasks.\n\nAdvantages of logEZ:\n\n1. Simplified initialization: The logEZ library makes it easier to set up logging with default values and simple customization options. You can easily configure log file names, logging levels, and toggle console or file logging with just a few parameters.\n2. Unified logging methods: The logEZ library offers a single class, MyLogger, with methods for different logging levels (debug, info, warning, error, critical), making it more convenient to use compared to the standard logging module, which requires calling separate functions for each logging level.\n3. Easier traceback logging: The logEZ library provides the exc_info parameter for error and critical level logs, making it more straightforward to include traceback information when logging exceptions.\n\nHowever, for more advanced logging use cases or if you require fine-grained control over your logging configuration, the built-in logging module offers more comprehensive features and flexibility. If you are already familiar with the standard logging module, you may not find logEZ to be significantly more helpful.\n\nIn summary, the logEZ library can be useful for developers looking for a simpler and more accessible interface for basic logging tasks. However, it might not offer substantial advantages over the built-in logging module for more experienced users or advanced logging scenarios.\n\n## What's next?\n\nWe have some exciting plans for the future development of logEZ, and we're always looking for ways to make it even more useful for our users. Here's a list of features we're considering adding:\n\n- [ ] Configuration from file support\n- [ ] Log rotation functionality\n- [ ] Support for custom log handlers\n- [ ] Colored console logs\n- [ ] Enhanced context information in log messages\n- [ ] Improved exception handling and logging\n- [ ] Integrated performance metrics\n- [ ] Advanced filtering capabilities\n- [ ] Asynchronous logging support\n- [ ] Better documentation and examples\n\n_We're open to contributions!_ If you'd like to help implement any of these features or have suggestions for improvements, please feel free to reach out to us. You can contact us at [gehlotkunal@outlook.com](mailto:gehlotkunal@outlook.com).\n\nWe're looking forward to collaborating with the community to make logEZ an even more valuable and versatile logging library for Python developers!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkunalgehlot%2Flogez","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkunalgehlot%2Flogez","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkunalgehlot%2Flogez/lists"}