Skip to content

Commit

Permalink
Add loglevel as a command line argument for witness (WebOfTrust#688)
Browse files Browse the repository at this point in the history
* Enable INFO level logging for keripy witnesses

keripy INFO level logs cover most of the cases.

hio.help.ogling module provides Ogler class for global logging in keripy. The class can print log to

- console
- syslog
- file

* Make log level configurable from command line argument

---------

Co-authored-by: Rubel Hassan Mollik <[email protected]>
Co-authored-by: Daniel Hardman <[email protected]>
  • Loading branch information
3 people authored Feb 26, 2024
1 parent 4e33296 commit de848bc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/keri/app/cli/commands/witness/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@
parser.add_argument("--keypath", action="store", required=False, default=None)
parser.add_argument("--certpath", action="store", required=False, default=None)
parser.add_argument("--cafilepath", action="store", required=False, default=None)
parser.add_argument("--loglevel", action="store", required=False, default="CRITICAL", help="Set log level to DEBUG | INFO | WARNING | ERROR | CRITICAL. Default is CRITICAL")


def launch(args):
help.ogler.level = logging.CRITICAL
help.ogler.reopen(name=args.name, temp=True, clear=True)
help.ogler.level = logging.getLevelName(args.loglevel)
help.ogler.reopen(name=args.name, temp=True, clear=True) # need to configure for logging persistent file

logger = help.ogler.getLogger()

Expand Down

0 comments on commit de848bc

Please sign in to comment.