Skip to content

-l|--prefix-location (p)wd|(g)it|git-(s)uper|(u)ser|(S)ystem #255

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

Open
yarikoptic opened this issue Mar 6, 2025 · 1 comment
Open

-l|--prefix-location (p)wd|(g)it|git-(s)uper|(u)ser|(S)ystem #255

yarikoptic opened this issue Mar 6, 2025 · 1 comment

Comments

@yarikoptic
Copy link
Member

for duct and con-duct ls and likely others.

ATM we by default use .duct/logs/ from current directory as the default location where to store our logs.

In principle we do provide means to alter that but it is "too verbose" since requires them modification of the full prefix.

For #170 and overall use within/under git we might want to place them under root folder of the git repository where it is executed.

My most frequent desire/use ATM is desire to just store them user-wide (platformdir python module could be used to determine location cross platforms), e.g. under ~/.var/duct/logs since e.g. I am not the owner of the folder where I am running the command or just this folder temporary but logs would be valuable longer term etc.

Hence proposal for an option to be able to quickly alter the folder to use instead of .duct/logs/ within prefix. Short version should be concise and thus e.g. -l u should store under user wide folder, and -l S some system wide (user might have some permission set there)

note: whenever we store somewhere else, we better also store pwd folder -- might need to be relative or might be full path... yet to be decided

@asmacdo
Copy link
Member

asmacdo commented Mar 7, 2025

I like it! Seems like this could go in smoothly by modifying the default DUCT_OUTPUT_PREFIX to {prefix_location}/.duct/logs/{datetime_filesafe}-{pid}_.

Some considerations:

-l and -p are already in use (--log-level and --output-prefix, respectively), so maybe instead --base-location -b instead?

  • pwd: default value
  • git: assuming we are in git repo, root of git repo. should raise if not.
  • git-super: the root of the highest parent of git submodules? should raise if not git repo.
  • user: ~/.var/ but possibly also configurable with another env var? IMO lets just .var, and make it configurable if someone asks.
  • system: /var/log/duct seems good to me

Specifically, /var/log/duct/ it makes me think that the prefix_location mapping should include the .duct/logs bit too, eg. DUCT_OUTPUT_PREFIX becomes {prefix_location}/{datetime_filesafe}-{pid}_, pwd becomes $(pwd)/.duct/logs user becomes ~/.var/duct/logs, etc.

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

No branches or pull requests

2 participants