{"id":23585360,"url":"https://github.com/jimmyyyeh/logger-master","last_synced_at":"2026-04-20T09:33:03.057Z","repository":{"id":112713691,"uuid":"306520591","full_name":"jimmyyyeh/logger-master","owner":"jimmyyyeh","description":"A package for pushing serialized error log which generated by loguru to remote host.","archived":false,"fork":false,"pushed_at":"2023-03-31T14:58:03.000Z","size":10,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-05-17T02:07:09.180Z","etag":null,"topics":["efk","fluentd","logging","mongodb","python","redis"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/logger-master/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jimmyyyeh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-10-23T03:33:07.000Z","updated_at":"2020-11-04T06:09:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"425101cc-0fbd-4ff4-9a66-ef70d3d55873","html_url":"https://github.com/jimmyyyeh/logger-master","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jimmyyyeh/logger-master","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimmyyyeh%2Flogger-master","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimmyyyeh%2Flogger-master/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimmyyyeh%2Flogger-master/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimmyyyeh%2Flogger-master/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jimmyyyeh","download_url":"https://codeload.github.com/jimmyyyeh/logger-master/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimmyyyeh%2Flogger-master/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32041399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"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":["efk","fluentd","logging","mongodb","python","redis"],"created_at":"2024-12-27T03:14:44.341Z","updated_at":"2026-04-20T09:33:03.043Z","avatar_url":"https://github.com/jimmyyyeh.png","language":"Python","funding_links":["https://www.buymeacoffee.com/jimmyyyeh"],"categories":[],"sub_categories":[],"readme":"# logger-master\n**A package for pushing serialized error log which generated by [loguru](https://github.com/Delgan/loguru \"loguru\") to remote storage.**\n\n## Description:\nA package for pushing serialized error log which generated by [loguru](https://github.com/Delgan/loguru \"loguru\") to remote storage (including mongodb / redis / fluentd).\n\n## How To Use:\n\n### With MongoDB\n* parameters:\n    - mongo_instance(object): mongodb instance\n    - mongo_db(str): database for storing log data\n    - mongo_collection(str): collection for storing log data\n    - terminal_displayed(bool): display log information on terminal screen or not\n    - rotation(str): [loguru](https://github.com/Delgan/loguru#modern-string-formatting-using-braces-style) rotation\n    - serialize(bool): data serialized or not\n    - log_format(str): [loguru](https://github.com/Delgan/loguru#modern-string-formatting-using-braces-style) format\n    - log_path(str): file path for storing log data\n    - custom_func(function): function for custom serialized data\n```python\nimport json\nfrom pymongo import MongoClient\nfrom logger_master.logger import MongoLogger\n\n# pushing log to mongodb instance\n\nmongo_uri = 'mongodb://root:root@localhost:27017/?authMechanism=SCRAM-SHA-1'\nmongo_instance = MongoClient(mongo_uri)\n\n# basic usage for pushing log with specific database and collection\nlogger = MongoLogger(mongo_instance=mongo_instance,\n                     mongo_db='my_log',\n                     mongo_collection='my_log_collection')\n\n# pushing serialize log to ./my_log/log_file\nlogger = MongoLogger(mongo_instance=mongo_instance,\n                     mongo_db='my_log',\n                     mongo_collection='my_log_collection',\n                     serialize=True,\n                     log_path='./my_log/log_file',\n                     rotation='1 week')\n\n# disable display log on screen\nlogger = MongoLogger(mongo_instance=mongo_instance,\n                     mongo_db='my_log',\n                     mongo_collection='my_log_collection',\n                     log_path='./my_log/log_file',\n                     terminal_displayed=False)\n\n# pushing serialized log with custom format\ndef custom_function(serialized_data):\n    if not isinstance(serialized_data, dict):\n        serialized_data = json.loads(serialized_data)\n    serialized_data.update({'new_key': 'new_value'})\n    return serialized_data\n\n\nlogger = MongoLogger(mongo_instance=mongo_instance,\n                     mongo_db='my_log',\n                     mongo_collection='my_log_collection', \n                     custom_func=custom_function)\n\ntry:\n    100 / 0\nexcept Exception as e:\n    logger.error(str(e))\n```\n\n### With Redis\n* parameters:\n    - redis_instance(object): redis instance\n    - key_prefix(str): prefix for redis key\n    - terminal_displayed(bool): display log information on terminal screen or not\n    - rotation(str): [loguru](https://github.com/Delgan/loguru#modern-string-formatting-using-braces-style) rotation\n    - serialize(bool): data serialized or not\n    - log_format(str): [loguru](https://github.com/Delgan/loguru#modern-string-formatting-using-braces-style) format\n    - log_path(str): file path for storing log data\n    - custom_func(function): function for custom serialized data\n```python\nimport json\nimport redis\nfrom logger_master.logger import RedisLogger\n\n# basic usage for pushing log to redis instance\n\nredis_instance = redis.StrictRedis(host='localhost',\n                                   password='root',\n                                   port='root')\n\n# pushing log to mongodb with 'my_error_log' key prefix\nlogger = RedisLogger(redis_instance=redis_instance,\n                     key_prefix='my_error_log')\n\n# pushing serialize log to ./my_log/log_file\nlogger = RedisLogger(redis_instance=redis_instance,\n                     key_prefix='my_error_log',\n                     serialize=True,\n                     log_path='./my_log/log_file',\n                     rotation='1 week')\n\n# disable display log on screen\nlogger = RedisLogger(redis_instance=redis_instance,\n                     key_prefix='my_error_log',\n                     log_path='./my_log/log_file',\n                     terminal_displayed=False)\n\n# pushing serialized log with custom format\ndef custom_function(serialized_data):\n    if not isinstance(serialized_data, dict):\n        serialized_data = json.loads(serialized_data)\n    serialized_data.update({'new_key': 'new_value'})\n    return serialized_data\n\n\nlogger = RedisLogger(redis_instance=redis_instance,\n                     key_prefix='my_error_log',\n                     custom_func=custom_function)\n\ntry:\n    100 / 0\nexcept Exception as e:\n    logger.error(str(e))\n```\n\n### With Fluentd\n* parameters:\n    - hostname(str): fluentd hostname\n    - port(int): fluentd port\n    - key_prefix(str): prefix for fluentd key\n    - terminal_displayed(bool): display log information on terminal screen or not\n    - rotation(str): [loguru](https://github.com/Delgan/loguru#modern-string-formatting-using-braces-style) rotation\n    - serialize(bool): data serialized or not\n    - log_format(str): [loguru](https://github.com/Delgan/loguru#modern-string-formatting-using-braces-style) format\n    - log_path(str): file path for storing log data\n    - custom_func(function): function for custom serialized data\n```python\nimport json\nfrom logger_master import FluentdLogger\n\n# pushing log log to fluentd\n\n# basic usage for pushing log data to fluentd\nlogger = FluentdLogger(hostname='localhost',\n                       port=24224,\n                       key_prefix='mongo')\n\n# pushing serialize log to ./my_log/log_file\nlogger = FluentdLogger(hostname='localhost',\n                       port=24224,\n                       key_prefix='mongo',\n                       serialize=True,\n                       log_path='./my_log/log_file',\n                       rotation='1 week')\n\n# disable display log on screen\nlogger = FluentdLogger(hostname='localhost',\n                       port=24224,\n                       key_prefix='mongo',\n                       log_path='./my_log/log_file',\n                       terminal_displayed=False)\n\n\n# pushing serialized log with custom format\ndef custom_function(serialized_data):\n    if not isinstance(serialized_data, dict):\n        serialized_data = json.loads(serialized_data)\n    serialized_data.update({'new_key': 'new_value'})\n    return serialized_data\n\n\nlogger = FluentdLogger(hostname='localhost',\n                       port=24224,\n                       key_prefix='mongo',\n                       custom_func=custom_function)\n\ntry:\n    1 / 0\nexcept Exception as e:\n    logger.error(msg=str(e))\n```\n**you can also push log to both fluentd and mongodb with [fluent-plugin-mongo](https://docs.fluentd.org/output/mongo).**\n\n---\n\u003ca href=\"https://www.buymeacoffee.com/jimmyyyeh\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-blue.png\" alt=\"Buy Me A Coffee\" height=\"40\" width=\"175\"\u003e\u003c/a\u003e\n\n**Buy me a coffee, if you like it!**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimmyyyeh%2Flogger-master","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimmyyyeh%2Flogger-master","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimmyyyeh%2Flogger-master/lists"}