util/intelp2m: Add logger

Add logging to a file, ./logs.txt by default. --logs option is used to
override this path. Error messages are duplicated to the console.

Change-Id: I97aba146b6d8866a7fa46bac80c27c0896b26cf7
Signed-off-by: Maxim Polyakov <max.senia.poliak@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70542
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Maxim Polyakov 2022-12-05 11:41:51 +03:00 committed by Felix Singer
commit be7eb06131
6 changed files with 67 additions and 2 deletions

View file

@ -87,6 +87,7 @@ basic functions:
-v | -version Print version
-file <path> Set path to the inteltool file. <inteltool.log> by default
-out <path> Set path to the generated file. <generate/gpio.h> by default
-logs <path> Override the log file path. <logs.txt> by default
-p | -platform <type> Set the PCH platform type. <sunrise> by default
(enter ? to show datails)
@ -193,6 +194,8 @@ func ParseOptions() {
flag.Usage = Usage
flag.StringVar(&p2m.Config.InputPath, "file", "inteltool.log", "")
flag.StringVar(&p2m.Config.OutputPath, "out", "generate/gpio.h", "")
flag.StringVar(&p2m.Config.LogsPath, "logs", "logs.txt", "")
help := flag.Bool("help", false, "")
vers, v := flag.Bool("version", false, ""), flag.Bool("v", false, "")