Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --log-file & \log-file option to always capture output #1461

Merged
merged 7 commits into from
May 1, 2024

Conversation

saucoide
Copy link
Contributor

@saucoide saucoide commented Apr 22, 2024

Description

Currently outputting to a file via \o disables the console output, however i often find
myself wanting to both log the results & see them in the terminal too #1424

This patch would add a cli arg --log-file, behaving as the same option in psql* + a
\log-file special command to enable/disable it from the console

* https://www.postgresql.org/docs/current/app-psql.html#APP-PSQL-OPTION-LOG-FILE

Maybe this is just useful for me and not worth adding but thought i'd submit it anyway,
i'll update changelog, etc later if you decide it's ok to merge

Checklist

  • I've added this contribution to the changelog.rst.
  • I've added my name to the AUTHORS file (or it's already there).
  • I installed pre-commit hooks (pip install pre-commit && pre-commit install), and ran black on my code.
  • Please squash merge this pull request (uncheck if you'd like us to merge as multiple commits)

pgcli/main.py Fixed Show fixed Hide fixed
pgcli/main.py Fixed Show fixed Hide fixed
@j-bennet
Copy link
Contributor

@saucoide This can be useful, sure. Go ahead with the PR. Thank you!

pgcli/main.py Outdated Show resolved Hide resolved
pgcli/main.py Outdated Show resolved Hide resolved
pgcli/main.py Outdated Show resolved Hide resolved
tests/test_main.py Outdated Show resolved Hide resolved
saucoide and others added 5 commits April 28, 2024 23:21
Currently outputting to a file via \o disables the console output
This patch adds a `--log-file` cli arg with similar behavior to `psql`* and a \log-file
special command to enable/disable it from the console

*https://www.postgresql.org/docs/current/app-psql.html#APP-PSQL-OPTION-LOG-FILE
Co-authored-by: Irina Truong <637013+j-bennet@users.noreply.github.com>
Co-authored-by: Irina Truong <637013+j-bennet@users.noreply.github.com>
Co-authored-by: Irina Truong <637013+j-bennet@users.noreply.github.com>
@j-bennet j-bennet merged commit ce7f76a into dbcli:main May 1, 2024
7 checks passed
@j-bennet
Copy link
Contributor

j-bennet commented May 1, 2024

Thank you @saucoide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants