{"id":15581732,"url":"https://github.com/unixorn/thelogrus","last_synced_at":"2026-01-23T14:44:47.562Z","repository":{"id":44159795,"uuid":"213246420","full_name":"unixorn/thelogrus","owner":"unixorn","description":"Python 3 version of logrus","archived":false,"fork":false,"pushed_at":"2022-10-24T21:39:51.000Z","size":83,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T05:44:50.959Z","etag":null,"topics":["cli","hacktoberfest","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unixorn.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":"unixorn","open_collective":null,"ko_fi":"unixorn","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2019-10-06T21:26:27.000Z","updated_at":"2022-08-20T20:13:32.000Z","dependencies_parsed_at":"2022-09-10T02:23:28.281Z","dependency_job_id":null,"html_url":"https://github.com/unixorn/thelogrus","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/unixorn/thelogrus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unixorn%2Fthelogrus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unixorn%2Fthelogrus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unixorn%2Fthelogrus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unixorn%2Fthelogrus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unixorn","download_url":"https://codeload.github.com/unixorn/thelogrus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unixorn%2Fthelogrus/sbom","scorecard":{"id":910511,"data":{"date":"2025-08-11","repo":{"name":"github.com/unixorn/thelogrus","commit":"fa8322df0c6bec80e2d85c13532689d94f53e6a9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/11 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/awesomebot.yml:1","Warn: no topLevel permission defined: .github/workflows/superlinter.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/awesomebot.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/unixorn/thelogrus/awesomebot.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/awesomebot.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/unixorn/thelogrus/awesomebot.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/superlinter.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/unixorn/thelogrus/superlinter.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/superlinter.yml:50: update your workflow using https://app.stepsecurity.io/secureworkflow/unixorn/thelogrus/superlinter.yml/main?enable=pin","Warn: containerImage not pinned by hash: Dockerfile:1: pin your Docker image by updating unixorn/debian-py3 to unixorn/debian-py3@sha256:e3c9d44011027559e6e830b10dc964b5a7436fde96ef4cc527c0e96212ee0327","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   1 containerImage dependencies pinned","Info:   1 out of   1 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2022-42969"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-24T18:57:02.346Z","repository_id":44159795,"created_at":"2025-08-24T18:57:02.346Z","updated_at":"2025-08-24T18:57:02.346Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28694457,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T14:15:13.573Z","status":"ssl_error","status_checked_at":"2026-01-23T14:09:05.534Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cli","hacktoberfest","python3"],"created_at":"2024-10-02T19:53:57.512Z","updated_at":"2026-01-23T14:44:47.527Z","avatar_url":"https://github.com/unixorn.png","language":"Python","funding_links":["https://patreon.com/unixorn","https://ko-fi.com/unixorn"],"categories":[],"sub_categories":[],"readme":"# logrus\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![GitHub stars](https://img.shields.io/github/stars/unixorn/thelogrus.svg)](https://github.com/unixorn/thelogrus/stargazers)\n[![Code Climate](https://codeclimate.com/github/unixorn/thelogrus/badges/gpa.svg)](https://codeclimate.com/github/unixorn/thelogrus)\n[![Issue Count](https://codeclimate.com/github/unixorn/thelogrus/badges/issue_count.svg)](https://codeclimate.com/github/unixorn/thelogrus)\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n## Table of Contents\n\n- [Installation](#installation)\n- [License](#license)\n- [Included Commands](#included-commands)\n  - [human-time](#human-time)\n- [Included functions](#included-functions)\n  - [thelogrus.cli](#thelogruscli)\n    - [exec_subcommand(unfound)](#exec_subcommandunfound)\n    - [find_subcommand(args)](#find_subcommandargs)\n    - [is_program(name)](#is_programname)\n    - [run(command)](#runcommand)\n  - [thelogrus.logging](#thelogruslogging)\n    - [getCustomLogger(name, logLevel)](#getcustomloggername-loglevel)\n  - [thelogrus.time](#thelogrustime)\n    - [humanTime(seconds)](#humantimeseconds)\n  - [thelogrus.utils](#thelogrusutils)\n    - [mkdir_p(path)](#mkdir_ppath)\n    - [obfuscateString(snippet, showLength=5, smear='*')](#obfuscatestringsnippet-showlength5-smear)\n    - [squashDicts(*dict_args)](#squashdictsdict_args)\n  - [thelogrus.yaml](#thelogrusyaml)\n    - [readYamlFile(path: str)](#readyamlfilepath-str)\n    - [writeYamlFile(path: str, data)](#writeyamlfilepath-str-data)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\nThe logrus is a collection of random utility functions. Nothing in here is all that special, they're just yet another implementation of functions I've rewritten at every job to use in various utility scripts. By open sourcing them now, I'm hoping to not have to write them yet again.\n\nAnd yes, the name is from Zelazny's Amber series.\n\n## Installation\n\n`pip install thelogrus`\n\n## License\n\nApache 2.0 license.\n\n## Included Commands\n\n### human-time\n\nTakes a value in seconds either from stdin or as arg 1 and converts it to a more meat-friendly format using the `humanTime` function.\n\n`human-time 1234` will print \"20 minutes, 34 seconds\"\n\n## Included functions\n\n### thelogrus.cli\n\n#### exec_subcommand(unfound)\n\nCreates a `git`-style driver command. If your script is named `foo`, and is run as `foo bar baz` and there is an executable in your `$PATH` named `foo-bar`, it will call `foo-bar` with `baz` as the command-line argument.\n\n`unfound` is an optional argument that should be a function pointer and will be called if `exec_subcommand` can't find a suitable subcommand. Mainly useful for you to have a custom usage message.\n\nExample usage:\n\n```python\n#!/usr/bin/env python3\n#\n# Test script for thelogrus\n#\n# Confirms that thelogrus.cli.exec_subcommand works as expected\n#\n# Copyright 2019, Joe Block \u003cjpb@unixorn.net\u003e\n\nimport sys\nfrom thelogrus.cli import exec_subcommand\n\n\ndef _usage(message):\n  '''\n  Custom usage printer\n  '''\n  print(\"%s\" % sys.argv[0])\n  print(\"Called as %s\" % (' '.join(sys.argv)))\n  print(\"Oh look, a custom usage message.\")\n  print(\"Attempted to find an executable using all the permutations of %s with no luck.\" % '-'.join(sys.argv))\n  print(\"%s\" % message)\n\n\nif __name__ == '__main__':\n  exec_subcommand(unfound=_usage)\n```\n\n#### find_subcommand(args)\n\nGiven a list ['foo','bar', 'baz'], attempts to create a command name in the format `foo-bar-baz`. If that command exists, we run it. If it doesn't, we check to see if `foo-bar` exists, in which case we run `foo-bar baz`. We keep slicing chunks off the end of the command name and adding them to the argument list until we find a valid command name we can run.\n\nThis allows us to easily make git-style command drivers where for example we have a driver script, `foo`, and subcommand scripts `foo-bar` and `foo-baz`, and when the user types `foo bar foobar` we find the foo-bar script and run it as `foo-bar foobar`\n\nExample usage:\n\n```python\n#!/usr/bin/env python3\n\nimport os\nimport subprocess\nimport sys\nfrom thelogrus.cli import find_subcommand\n\n\ndef subcommander_driver():\n  '''\n  Process the command line arguments and run the appropriate subcommand.\n\n  We want to be able to do git-style handoffs to subcommands where if we\n  do `foo blah foo bar` and the executable foo-blah-foo exists, we'll call\n  it with the argument bar.\n\n  We deliberately don't do anything with the arguments other than hand\n  them off to the foo subcommand. Subcommands are responsible for their\n  own argument parsing.\n  '''\n  try:\n    (command, args) = find_subcommand(sys.argv)\n\n    # If we can't construct a subcommand from sys.argv, it'll still be able\n    # to find this driver script, and re-running ourself isn't useful.\n    if os.path.basename(command) == sys.argv[0]:\n      print(\"Could not find a subcommand for %s\" % ' '.join(sys.argv))\n      sys.exit(1)\n  except Exception as e:\n    print(str(e))\n    sys.exit(1)\n  subprocess.check_call([command] + args)\n\n\nif __name__ == '__main__':\n  subcommander_driver()\n```\n\n#### is_program(name)\n\nSearch for a given program in `$PATH`, and return `True` if it exists and is executable.\n\n#### run(command)\n\nRuns a command (either a str or list) and returns its `stdout`.\n\n### thelogrus.logging\n\n#### getCustomLogger(name, logLevel)\n\nReturns a custom logger with nicely formatted output.\n\n### thelogrus.time\n\n#### humanTime(seconds)\n\nTakes a value in seconds, returns it in meat-friendly format. `humanFriendlyTime(8675309)` would return \"100 days 9 hours 48 minutes 29 seconds\".\n\n### thelogrus.utils\n\n#### mkdir_p(path)\n\nos module doesn't have a `mkdir -p` equivalent so added one.\n\n#### obfuscateString(snippet, showLength=5, smear='*')\n\nTakes a string, chops off showLength characters from the beginning and end and replaces everything else with the `smear` character. Really only useful for displaying just enough of a credential in a log to show it's using the correct credential, but not revealing the actual credential.\n\n#### squashDicts(*dict_args)\n\nReturn a dict that is all the dict_args squashed together.\n\n### thelogrus.yaml\n\n#### readYamlFile(path: str)\n\nReturn the data structure contained in a YAML file\n\nArgs:\n    path (str): Path to read from\n\nReturns:\n    Data decoded from YAML file content\n\n#### writeYamlFile(path: str, data)\n\nWrites a data structure or object into a YAML file\n\nArgs:\n    path (str): Path to data file\n    data (any): Data to convert and write\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funixorn%2Fthelogrus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funixorn%2Fthelogrus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funixorn%2Fthelogrus/lists"}