Skip to content

Commit

Permalink
cli: expand user's home directory for logging
Browse files Browse the repository at this point in the history
* Allow to specify a log path relative to the user's home directory in
  the configuration file.

Bug: T244840
Change-Id: I229084cad7fd1186f631d4cb41d95f4f9260aa6b
  • Loading branch information
volans- committed Feb 25, 2021
1 parent 5795dbf commit 38186a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cumin/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def main(argv=None):
user = get_running_user()
config = cumin.Config(args.config)
validate_config(config)
setup_logging(config['log_file'], debug=args.debug, trace=args.trace)
setup_logging(os.path.expanduser(config['log_file']), debug=args.debug, trace=args.trace)
except cumin.CuminError as e:
stderr(e)
return 2
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# By default Cumin load the configuration from /etc/cumin/config.yaml, but it can be overriden by command line argument
#
transport: clustershell # Default transport to use, can be overriden by command line argument
log_file: logs/cumin.log # Absolute or relative path for the log file
log_file: ~/.cumin/cumin.log # Absolute or relative path for the log file, expands ~ into the user's home directory
# If set, use this backend to parse the query first and only if it fails, fallback to parse it with the general
# multi-query grammar [optional]
default_backend: direct
Expand Down

0 comments on commit 38186a7

Please sign in to comment.