![Lines of code](https://sloc.xyz/github/sandialabs/shell-logger/?category=code)
[![codecov](https://codecov.io/gh/sandialabs/shell-logger/branch/master/graph/badge.svg?token=FmDStZ6FVR)](https://codecov.io/gh/sandialabs/shell-logger)
[![CodeFactor](https://www.codefactor.io/repository/github/sandialabs/shell-logger/badge/master)](https://www.codefactor.io/repository/github/sandialabs/shell-logger/overview/master)
[![CodeQL](https://github.com/sandialabs/shell-logger/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/sandialabs/shell-logger/actions/workflows/github-code-scanning/codeql)
[![Continuous Integration](https://github.com/sandialabs/shell-logger/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/sandialabs/shell-logger/actions/workflows/continuous-integration.yml)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)
[![GitHub contributors](https://img.shields.io/github/contributors/sandialabs/shell-logger.svg)](https://github.com/sandialabs/shell-logger/graphs/contributors)
[![Documentation Status](https://readthedocs.org/projects/shell-logger/badge/?version=latest)](https://shell-logger.readthedocs.io/en/latest/?badge=latest)
[![License](https://img.shields.io/badge/license-BSD_3_Clause-black)](LICENSE.md)
[![Merged PRs](https://img.shields.io/github/issues-pr-closed-raw/sandialabs/shell-logger.svg?label=merged+PRs)](https://github.com/sandialabs/shell-logger/pulls?q=is:pr+is:merged)
[![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/8863/badge)](https://bestpractices.coreinfrastructure.org/projects/8863)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/sandialabs/shell-logger/badge)](https://securityscorecards.dev/viewer/?uri=github.com/sandialabs/shell-logger)
![Platforms](https://img.shields.io/badge/Platforms-Linux%7CMacOS-orange)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![pre-commit.ci Status](https://results.pre-commit.ci/badge/github/sandialabs/shell-logger/master.svg)](https://results.pre-commit.ci/latest/github/sandialabs/shell-logger/master)
[![PyPI - Version](https://img.shields.io/pypi/v/shell-logger-sandialabs?label=PyPI)](https://pypi.org/project/shell-logger-sandialabs/)
![PyPI - Downloads](https://img.shields.io/pypi/dm/shell-logger-sandialabs?label=PyPI%20downloads)
![Python Version](https://img.shields.io/badge/Python-3.9|3.10|3.11|3.12|3.13-blue.svg)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
> **NOTICE:** After using this package for a few years, we realized we'd
> attempted to do too many things at once with it. It still provides
> tremendous functionality for a wide variety of use cases, but for particular
> corner cases, it became apparent that design decisions made early on were
> hampering forward progress, and we wouldn't recommend doing things the same
> way today. Certain aspects of its functionality have inspired more focused
> packages ([reverse-argparse][reverse-argparse],
> [staged-script][staged-script]), and we hope to do the same with more
> functionality in the future. For the time being, though, don't expect much
> development and maintenance here. That said, if you use `shell-logger` and
> are eager to contribute to its longevity, let us know.
[reverse-argparse]: https://github.com/sandialabs/reverse_argparse
[staged-script]: https://github.com/sandialabs/staged-script
# shell-logger
The `shell-logger` Python package allows you to interact with the shell, while
logging various metadata, statistics, and trace information. Any time you're
tempted to write your own wrapper around things like `subprocess.Popen()` or
`subprocess.run()`, consider using `shell_logger.ShellLogger.log()` instead.
If you're familiar with [the Unix script command][script], this is similar in
principle, but with substantially more functionality. If you're familiar with
[Python's logging module][logging], the motivation is similar, but this intends
to capture what's happening *in the shell* rather than in Python itself.
[script]: https://man7.org/linux/man-pages/man1/script.1.html
[logging]: https://docs.python.org/3/library/logging.html
## Installation
To get up and running with `shell-logger`, simply:
```bash
python3 -m pip install shell-logger-sandialabs
```
## Usage
Once the package is installed, you can simply
```python
from shell_logger import ShellLogger
sl = ShellLogger("Title of Log File")
sl.log("Execute my first command in the shell.", "echo 'Hello World'")
sl.finalize()
```
For more detailed usage and API information, please see
[our documentation][readthedocs].
[readthedocs]: https://shell-logger.readthedocs.io
## Where to Get Help
If you're having trouble with `shell-logger`, or just want to ask a question,
head on over to [our issue board][issues]. If a quick search doesn't yield
what you're looking for, feel free to file an issue.
[issues]: https://github.com/sandialabs/shell-logger/issues
## Contributing
If you're interested in contributing to the development of `shell-logger`, we'd
love to have your help :grinning: Check out our
[contributing guidelines](CONTRIBUTING.md) for how to get started.
[Past contributors][contributors] include:
* [@bbraunj](https://github.com/bbraunj)
* [@sswan](https://github.com/sswan)
* [@dc-snl](https://github.com/dc-snl)
* [@jmgate](https://github.com/jmgate)
* [@mvlopri](https://github.com/mvlopri)
[contributors]: https://github.com/sandialabs/shell-logger/graphs/contributors
## License & Copyright
See [LICENSE.md](LICENSE.md) and [COPYRIGHT.md](COPYRIGHT.md).
## Credits
Special thanks to the EMPIRE project for investing in the initial development
of this tool, and [the GMS project][gms] for serving as a second user and
contributing to its clean-up.
[gms]: https://github.com/SNL-GMS/GMS-PI25
Raw data
{
"_id": null,
"home_page": "https://github.com/sandialabs/shell-logger",
"name": "shell-logger-sandialabs",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "shell, logging",
"author": "Josh Braun",
"author_email": "josbrau@sandia.gov",
"download_url": "https://files.pythonhosted.org/packages/c2/4d/a48daa2617a258331dfe4e935aa69f11dc4040b1606652cf8e3a0c5a720b/shell_logger_sandialabs-2.0.1.tar.gz",
"platform": null,
"description": "![Lines of code](https://sloc.xyz/github/sandialabs/shell-logger/?category=code)\n[![codecov](https://codecov.io/gh/sandialabs/shell-logger/branch/master/graph/badge.svg?token=FmDStZ6FVR)](https://codecov.io/gh/sandialabs/shell-logger)\n[![CodeFactor](https://www.codefactor.io/repository/github/sandialabs/shell-logger/badge/master)](https://www.codefactor.io/repository/github/sandialabs/shell-logger/overview/master)\n[![CodeQL](https://github.com/sandialabs/shell-logger/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/sandialabs/shell-logger/actions/workflows/github-code-scanning/codeql)\n[![Continuous Integration](https://github.com/sandialabs/shell-logger/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/sandialabs/shell-logger/actions/workflows/continuous-integration.yml)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)\n[![GitHub contributors](https://img.shields.io/github/contributors/sandialabs/shell-logger.svg)](https://github.com/sandialabs/shell-logger/graphs/contributors)\n[![Documentation Status](https://readthedocs.org/projects/shell-logger/badge/?version=latest)](https://shell-logger.readthedocs.io/en/latest/?badge=latest)\n[![License](https://img.shields.io/badge/license-BSD_3_Clause-black)](LICENSE.md)\n[![Merged PRs](https://img.shields.io/github/issues-pr-closed-raw/sandialabs/shell-logger.svg?label=merged+PRs)](https://github.com/sandialabs/shell-logger/pulls?q=is:pr+is:merged)\n[![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/8863/badge)](https://bestpractices.coreinfrastructure.org/projects/8863)\n[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/sandialabs/shell-logger/badge)](https://securityscorecards.dev/viewer/?uri=github.com/sandialabs/shell-logger)\n![Platforms](https://img.shields.io/badge/Platforms-Linux%7CMacOS-orange)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)\n[![pre-commit.ci Status](https://results.pre-commit.ci/badge/github/sandialabs/shell-logger/master.svg)](https://results.pre-commit.ci/latest/github/sandialabs/shell-logger/master)\n[![PyPI - Version](https://img.shields.io/pypi/v/shell-logger-sandialabs?label=PyPI)](https://pypi.org/project/shell-logger-sandialabs/)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/shell-logger-sandialabs?label=PyPI%20downloads)\n![Python Version](https://img.shields.io/badge/Python-3.9|3.10|3.11|3.12|3.13-blue.svg)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n\n> **NOTICE:** After using this package for a few years, we realized we'd\n> attempted to do too many things at once with it. It still provides\n> tremendous functionality for a wide variety of use cases, but for particular\n> corner cases, it became apparent that design decisions made early on were\n> hampering forward progress, and we wouldn't recommend doing things the same\n> way today. Certain aspects of its functionality have inspired more focused\n> packages ([reverse-argparse][reverse-argparse],\n> [staged-script][staged-script]), and we hope to do the same with more\n> functionality in the future. For the time being, though, don't expect much\n> development and maintenance here. That said, if you use `shell-logger` and\n> are eager to contribute to its longevity, let us know.\n\n[reverse-argparse]: https://github.com/sandialabs/reverse_argparse\n[staged-script]: https://github.com/sandialabs/staged-script\n\n# shell-logger\n\nThe `shell-logger` Python package allows you to interact with the shell, while\nlogging various metadata, statistics, and trace information. Any time you're\ntempted to write your own wrapper around things like `subprocess.Popen()` or\n`subprocess.run()`, consider using `shell_logger.ShellLogger.log()` instead.\nIf you're familiar with [the Unix script command][script], this is similar in\nprinciple, but with substantially more functionality. If you're familiar with\n[Python's logging module][logging], the motivation is similar, but this intends\nto capture what's happening *in the shell* rather than in Python itself.\n\n[script]: https://man7.org/linux/man-pages/man1/script.1.html\n[logging]: https://docs.python.org/3/library/logging.html\n\n## Installation\n\nTo get up and running with `shell-logger`, simply:\n```bash\npython3 -m pip install shell-logger-sandialabs\n```\n\n## Usage\n\nOnce the package is installed, you can simply\n```python\nfrom shell_logger import ShellLogger\nsl = ShellLogger(\"Title of Log File\")\nsl.log(\"Execute my first command in the shell.\", \"echo 'Hello World'\")\nsl.finalize()\n```\n\nFor more detailed usage and API information, please see\n[our documentation][readthedocs].\n\n[readthedocs]: https://shell-logger.readthedocs.io\n\n## Where to Get Help\n\nIf you're having trouble with `shell-logger`, or just want to ask a question,\nhead on over to [our issue board][issues]. If a quick search doesn't yield\nwhat you're looking for, feel free to file an issue.\n\n[issues]: https://github.com/sandialabs/shell-logger/issues\n\n## Contributing\n\nIf you're interested in contributing to the development of `shell-logger`, we'd\nlove to have your help :grinning: Check out our\n[contributing guidelines](CONTRIBUTING.md) for how to get started.\n[Past contributors][contributors] include:\n* [@bbraunj](https://github.com/bbraunj)\n* [@sswan](https://github.com/sswan)\n* [@dc-snl](https://github.com/dc-snl)\n* [@jmgate](https://github.com/jmgate)\n* [@mvlopri](https://github.com/mvlopri)\n\n[contributors]: https://github.com/sandialabs/shell-logger/graphs/contributors\n\n## License & Copyright\n\nSee [LICENSE.md](LICENSE.md) and [COPYRIGHT.md](COPYRIGHT.md).\n\n## Credits\n\nSpecial thanks to the EMPIRE project for investing in the initial development\nof this tool, and [the GMS project][gms] for serving as a second user and\ncontributing to its clean-up.\n\n[gms]: https://github.com/SNL-GMS/GMS-PI25\n\n",
"bugtrack_url": null,
"license": "LICENSE.md",
"summary": "A tool for keeping track of Python's interactions with the shell.",
"version": "2.0.1",
"project_urls": {
"CI": "https://github.com/sandialabs/shell-logger/actions",
"Documentation": "https://shell-logger.readthedocs.io",
"Homepage": "https://github.com/sandialabs/shell-logger",
"Issues": "https://github.com/sandialabs/shell-logger/issues",
"Repository": "https://github.com/sandialabs/shell-logger"
},
"split_keywords": [
"shell",
" logging"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "69d0d92c96f2f318c5b44c90a8ebf5465af93d7d25ab9b100a4b8c9846fb3e19",
"md5": "be4e5cef3717b0649f56feb59e726882",
"sha256": "df1389620475fa979b733749c402795ba45edb69289c79c3aaae9f946ca14679"
},
"downloads": -1,
"filename": "shell_logger_sandialabs-2.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "be4e5cef3717b0649f56feb59e726882",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 183502,
"upload_time": "2024-12-02T20:22:14",
"upload_time_iso_8601": "2024-12-02T20:22:14.379856Z",
"url": "https://files.pythonhosted.org/packages/69/d0/d92c96f2f318c5b44c90a8ebf5465af93d7d25ab9b100a4b8c9846fb3e19/shell_logger_sandialabs-2.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c24da48daa2617a258331dfe4e935aa69f11dc4040b1606652cf8e3a0c5a720b",
"md5": "23a9b5f306142c083f920b0ed3a79677",
"sha256": "5987de887813906af0c96c357b32939daa07cad98c423390363399dd2d0350d8"
},
"downloads": -1,
"filename": "shell_logger_sandialabs-2.0.1.tar.gz",
"has_sig": false,
"md5_digest": "23a9b5f306142c083f920b0ed3a79677",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 175025,
"upload_time": "2024-12-02T20:22:16",
"upload_time_iso_8601": "2024-12-02T20:22:16.567153Z",
"url": "https://files.pythonhosted.org/packages/c2/4d/a48daa2617a258331dfe4e935aa69f11dc4040b1606652cf8e3a0c5a720b/shell_logger_sandialabs-2.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-02 20:22:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sandialabs",
"github_project": "shell-logger",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [],
"lcname": "shell-logger-sandialabs"
}