{"id":17055639,"url":"https://github.com/ansrivas/pylogging","last_synced_at":"2025-04-12T17:11:47.129Z","repository":{"id":13159914,"uuid":"73756187","full_name":"ansrivas/pylogging","owner":"ansrivas","description":"A small wrapper around python logging module which can easily format and write logs to file.","archived":false,"fork":false,"pushed_at":"2023-01-09T04:04:27.000Z","size":79,"stargazers_count":12,"open_issues_count":3,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T17:11:26.795Z","etag":null,"topics":["logging","python"],"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/ansrivas.png","metadata":{"files":{"readme":"README.rst","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}},"created_at":"2016-11-14T23:27:32.000Z","updated_at":"2023-03-04T09:42:04.000Z","dependencies_parsed_at":"2023-01-13T17:20:05.781Z","dependency_job_id":null,"html_url":"https://github.com/ansrivas/pylogging","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansrivas%2Fpylogging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansrivas%2Fpylogging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansrivas%2Fpylogging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansrivas%2Fpylogging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ansrivas","download_url":"https://codeload.github.com/ansrivas/pylogging/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248602312,"owners_count":21131616,"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":["logging","python"],"created_at":"2024-10-14T10:18:44.863Z","updated_at":"2025-04-12T17:11:47.095Z","avatar_url":"https://github.com/ansrivas.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"pylogging\n~~~~~~~~~\n\nA simple python logger which writes logs to disk with some default\nconfigs.\n\nCompatible with:\n~~~~~~~~~~~~~~~~\n\nPython 2.7 and 3.5+\n\nCurrent stable version:\n~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n    0.3.0\n\nInstallation:\n~~~~~~~~~~~~~\n\nInstall using pip\n^^^^^^^^^^^^^^^^^\n\n::\n\n    pip install git+https://github.com/ansrivas/pylogging.git --upgrade\n\nInstall by adding to requirements.txt of your project\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n-  Add the following lines to your ``requirements.txt`` file.\n   ``git+https://github.com/ansrivas/pylogging.git``\n\n-  Install all packages in your ``requirements.txt`` file by running the\n   command: ``$ pip install -r requirements.txt``\n\nInstall by adding to setup.py of your project\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n-  Add the following to the ``install_requires`` parameter of your setup\n   function: ``install_requires=['pylogging==0.2.6'],``\n\n-  Add the following to the ``dependency_links`` parameter of your setup\n   function:\n   ``dependency_links=['https://github.com/ansrivas/pylogging/tarball/master#egg=pylogging-0.2.6'],``\n\n-  Install your project along with ``pylogging`` by running the command:\n   ``python setup.py install``\n\nUsage:\n~~~~~~\n\n-  ``setup_logger`` sets up the global logger with the provided\n   settings. After calling it once, simply ``import logging`` and create\n   a logger for that module ``logger = logging.getLogger(__name__)`` and\n   use it at shown below.\n\n::\n\n    from pylogging import HandlerType, setup_logger\n    import logging\n\n    logger = logging.getLogger(__name__)\n\n    if __name__ == '__main__':\n        setup_logger(log_directory='./logs', file_handler_type=HandlerType.ROTATING_FILE_HANDLER, allow_console_logging=True)\n\n        logger.error(\"Error logs\")\n        logger.debug(\"Debug logs\")\n        logger.info(\"Info logs\")\n\nDevelopment installation\n^^^^^^^^^^^^^^^^^^^^^^^^^\n::\n\n  pip install -e .[dev]\n\n\nImportant arguments to ``setup_logger`` function:\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n  log_directory (str)            :directory to write log files to. Applicable only when `allow_file_logging` = True\n  file_handler_type              :object of logging handler from HandlerType class. Applicable only when `allow_file_logging` = True\n  allow_console_logging (bool)   :Turn off/on the console logging.\n  allow_file_logging (bool)      :Turn off/on if logs need to go in files as well.\n  backup_count (int)             :Number of files to backup before rotating the logs.\n  max_file_size_bytes (int)      :Size of file in bytes before rotating the file. Applicable only to ROTATING_FILE_HANDLER.\n  when_to_rotate (str)           :Duration after which a file can be rotated. Applicable only to TIME_ROTATING_FILE_HANDLER\n                                  Accepts following values:\n                                  'S'\tSeconds\n                                  'M'\tMinutes\n                                  'H'\tHours\n                                  'D'\tDays\n                                  'W0'-'W6'\tWeekday (0=Monday)\n                                  'midnight'\tRoll over at midnight\n  change_log_level (dict)        :A dictionary of handlers with corresponding log-level ( for eg. {'requests':'warning'} )\n  console_log_level (logging)    :Change the LogLevel of console log handler, default is logging.INFO (e.g. logging.DEBUG, logging.INFO)\n  gelf_handler                   :An external handler for graylog data publishing.\n  log_tags                       :Adding contextual information to a given log handler for e.g. {'app_name': 'My Perfect App'}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fansrivas%2Fpylogging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fansrivas%2Fpylogging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fansrivas%2Fpylogging/lists"}