-
Notifications
You must be signed in to change notification settings - Fork 8
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
Log to stderr by default instead of salt-server.log #213
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -43,11 +43,15 @@ def add_arguments(parser): | |||||
help="initialize the server, but don't launch it " | ||||||
"(useful for debugging/testing purposes)", | ||||||
) | ||||||
parser.add_argument( | ||||||
"--log-file", | ||||||
help="Redirect logs to the given file instead of writing to stderr", | ||||||
) | ||||||
parser.add_argument( | ||||||
"--log-level", | ||||||
choices=list(LOG_LEVEL_DICT.keys()) | ||||||
+ list(map(lambda level: level.upper(), LOG_LEVEL_DICT.keys())), | ||||||
default=["debug"], | ||||||
default=["warning"], | ||||||
nargs=1, | ||||||
help="Logging verbosity", | ||||||
) | ||||||
|
@@ -60,7 +64,7 @@ def main(): | |||||
|
||||||
log_level = loglevel_from_str(args.log_level[0]) | ||||||
logging.basicConfig( | ||||||
filename="salt-server.log", | ||||||
filename=args.log_file, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Oh, btw, I am doing something with this that might be a little confusing. If The related |
||||||
level=log_level, | ||||||
filemode="w", | ||||||
) | ||||||
|
@@ -72,7 +76,7 @@ def main(): | |||||
|
||||||
salt_server = SaltServer() | ||||||
setup_salt_server_capabilities(salt_server) | ||||||
salt_server.post_init(states, log_level) | ||||||
salt_server.post_init(states) | ||||||
|
||||||
if args.stop_after_init: | ||||||
return | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type
: Hmm checking the docs fortype
, it looks like it defaults to string, which agrees with what I see while testing. So we should be ok there, however we can add it to be more explicit if we want?From https://docs.python.org/3/library/argparse.html#type
nargs
: Ahh, I recall having trouble withnargs
in the past since it can be a little confusing. Looks like usingnargs=1
would convert it to a list, which would require the[0]
usage later on.From https://docs.python.org/3/library/argparse.html#nargs
It might be more clear to leave the
nargs=1
off, so we don't need the[0]
later?