Skip to content
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

Improved logging implementation #412

Merged
merged 10 commits into from
Jun 9, 2023
Merged

Improved logging implementation #412

merged 10 commits into from
Jun 9, 2023

Conversation

mshr-h
Copy link
Owner

@mshr-h mshr-h commented Mar 27, 2023

#366
The usage is something like this.

let logger: Logger = createLogger("Verilog"); // This is parent logger which outputs vscode.LogOutputChannel
logger.info("Info message");
let child_logger = logger.child("ChildA"); // The "[ChildA] " will be added when info/debug/warn/error calls.
child_logger.info("Message from child"); // The message is sent to the parent logger.

The output would be

Info message
[ChildA] Message from child"

Example output:

2023-03-27 21:07:55.419 [info] mshr-h.veriloghdl is now active.
2023-03-27 21:07:55.419 [info] [ExtensionManager] previousVersion: "1.11.3", currentVersion: "1.11.3"
2023-03-27 21:07:55.419 [info] [CtagsManager] ctags manager configure
2023-03-27 21:07:55.419 [info] [LintManager] Using linter: iverilog
2023-03-27 21:07:55.419 [info] [LintManager] [IcarusLinter] Executing IcarusLinter.lint()
2023-03-27 21:07:55.419 [info] [LintManager] [IcarusLinter] iverilog binary path: iverilog
2023-03-27 21:07:55.419 [info] [LintManager] [IcarusLinter] Execute
2023-03-27 21:07:55.419 [info] [LintManager] [IcarusLinter]   command: "iverilog -t null -g2012  /home/ubuntu/workspace/mshr-h/vscode-verilog-hdl-support/language_examples/systemverilog/module_1.sv"
2023-03-27 21:07:55.419 [info] [LintManager] [IcarusLinter]   cwd    : "/home/ubuntu/workspace/mshr-h/vscode-verilog-hdl-support/language_examples/systemverilog"
2023-03-27 21:07:55.419 [info] mshr-h.veriloghdl activation finished.
2023-03-27 21:07:55.419 [info] [VerilogDocumentSymbolProvider] [VerilogSymbol] Symbols Requested: file:///home/ubuntu/workspace/mshr-h/vscode-verilog-hdl-support/language_examples/systemverilog/module_1.sv
2023-03-27 21:07:55.419 [info] [CtagsManager] [Ctags] indexing...
2023-03-27 21:07:55.419 [info] [CtagsManager] [Ctags] executing ctags
2023-03-27 21:07:55.419 [info] [VerilogDocumentSymbolProvider] [VerilogSymbol] Symbols Requested: file:///home/ubuntu/workspace/mshr-h/vscode-verilog-hdl-support/language_examples/systemverilog/module_1.sv
2023-03-27 21:07:55.419 [info] [CtagsManager] [Ctags] indexing...
2023-03-27 21:07:55.419 [info] [CtagsManager] [Ctags] executing ctags
2023-03-27 21:07:58.594 [info] [LintManager] [IcarusLinter] Executing IcarusLinter.lint()
2023-03-27 21:07:58.594 [info] [LintManager] [IcarusLinter] iverilog binary path: iverilog
2023-03-27 21:07:58.594 [info] [LintManager] [IcarusLinter] Execute
2023-03-27 21:07:58.594 [info] [LintManager] [IcarusLinter]   command: "iverilog -t null -g2012  /home/ubuntu/workspace/mshr-h/vscode-verilog-hdl-support/language_examples/systemverilog/property_1.sv"
2023-03-27 21:07:58.594 [info] [LintManager] [IcarusLinter]   cwd    : "/home/ubuntu/workspace/mshr-h/vscode-verilog-hdl-support/language_examples/systemverilog"
2023-03-27 21:07:58.594 [info] [VerilogDocumentSymbolProvider] [VerilogSymbol] Symbols Requested: file:///home/ubuntu/workspace/mshr-h/vscode-verilog-hdl-support/language_examples/systemverilog/property_1.sv
2023-03-27 21:07:58.594 [info] [CtagsManager] [Ctags] indexing...
2023-03-27 21:07:58.594 [info] [CtagsManager] [Ctags] executing ctags
2023-03-27 21:07:58.597 [info] [LintManager] [IcarusLinter] 2 errors/warnings returned
2023-03-27 21:08:02.469 [info] [SystemVerilogFormatProvider] Temp file created at:/tmp/veribleVerilogFormatter-1949fb19e04948bd86f0c356cfcefb75.tmp.sv
2023-03-27 21:08:02.469 [info] [SystemVerilogFormatProvider] Executing command: verible-verilog-format --inplace /tmp/veribleVerilogFormatter-1949fb19e04948bd86f0c356cfcefb75.tmp.sv
2023-03-27 21:08:02.844 [info] [VerilogDocumentSymbolProvider] [VerilogSymbol] Symbols Requested: file:///home/ubuntu/workspace/mshr-h/vscode-verilog-hdl-support/language_examples/systemverilog/property_1.sv
2023-03-27 21:08:02.844 [info] [CtagsManager] [Ctags] indexing...
2023-03-27 21:08:02.844 [info] [CtagsManager] [Ctags] executing ctags
2023-03-27 21:08:04.549 [info] [LintManager] Executing runLintTool()
2023-03-27 21:08:05.004 [info] [LintManager] Using iverilog linter
2023-03-27 21:08:05.004 [info] [LintManager] [IcarusLinter] Executing IcarusLinter.lint()
2023-03-27 21:08:05.004 [info] [LintManager] [IcarusLinter] iverilog binary path: iverilog
2023-03-27 21:08:05.004 [info] [LintManager] [IcarusLinter] Execute
2023-03-27 21:08:05.004 [info] [LintManager] [IcarusLinter]   command: "iverilog -t null -g2012  /home/ubuntu/workspace/mshr-h/vscode-verilog-hdl-support/language_examples/systemverilog/property_1.sv"
2023-03-27 21:08:05.005 [info] [LintManager] [IcarusLinter]   cwd    : "/home/ubuntu/workspace/mshr-h/vscode-verilog-hdl-support/language_examples/systemverilog"
2023-03-27 21:08:05.009 [info] [LintManager] [IcarusLinter] 2 errors/warnings returned

@Raamakrishnan Any comment is welcome.

@mshr-h
Copy link
Owner Author

mshr-h commented Mar 27, 2023

Maybe this is better?

2023-03-27 21:07:55.419 [info] mshr-h.veriloghdl is now active.
2023-03-27 21:07:55.419 [info] ExtensionManager: previousVersion: "1.11.3", currentVersion: "1.11.3"
2023-03-27 21:07:55.419 [info] CtagsManager: ctags manager configure
2023-03-27 21:07:55.419 [info] LintManager: Using linter: iverilog
2023-03-27 21:07:55.419 [info] LintManager::IcarusLinter: Executing IcarusLinter.lint()
2023-03-27 21:07:55.419 [info] LintManager::IcarusLinter: iverilog binary path: iverilog
2023-03-27 21:07:55.419 [info] LintManager::IcarusLinter: Execute

@mshr-h mshr-h changed the title [WIP] Improve logging [WIP] Improved logging implementation Mar 28, 2023
@mshr-h
Copy link
Owner Author

mshr-h commented Mar 30, 2023

@mshr-h mshr-h self-assigned this Mar 30, 2023
@mshr-h
Copy link
Owner Author

mshr-h commented May 15, 2023

https://github.com/ziglang/zig/blob/master/lib/std/log.zig

[info] (default): Flux capacitor is starting to overheat
[warning] (nice_library): Something went very wrong, sorry

The output looks nicer to me.

@mshr-h
Copy link
Owner Author

mshr-h commented May 16, 2023

Python's logger uses getChild for generating child logger.
https://docs.python.org/3/library/logging.html#logging.Logger.getChild

@mshr-h mshr-h marked this pull request as ready for review June 9, 2023 09:59
@mshr-h mshr-h merged commit baa62cc into main Jun 9, 2023
@mshr-h mshr-h deleted the improve-logging branch June 9, 2023 10:00
@mshr-h mshr-h changed the title [WIP] Improved logging implementation Improved logging implementation Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant