-
Notifications
You must be signed in to change notification settings - Fork 112
[AIMIGRAPHX-371] Add logger with basic sinks #4469
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
Open
eddieliao
wants to merge
35
commits into
develop
Choose a base branch
from
logger
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
84d885b
Add basic logging functionality
eddieliao 5203de7
Formatting
eddieliao 625a627
Refactor logger to use variadic function and add record function
eddieliao b4a6ff6
Formatting
eddieliao 213fe9c
Add console and file logging using spdlog
eddieliao c818ecd
Formatting
eddieliao b6599ca
Add multi file logging; fix params not showing in logging
eddieliao 1fdb940
Fix color logging
eddieliao d8a8414
Add windows color logger
eddieliao 0cd773c
Add file-specific severity option
eddieliao 10a9ae1
Remove windows specific sinks, add unit tests
eddieliao 5c1fcff
Formatting
eddieliao 60b64c8
Cleanup
eddieliao 666e2c1
Merge branch 'develop' into logger
eddieliao 66f1d10
Remove spdlog usage, add thread safe access to sinks, update tests
eddieliao 5fbc196
Formatting
eddieliao 6889864
Add doc comments, error messages, use linux specific timestamp, remov…
eddieliao 3866156
Formatting
eddieliao 6d54ebd
Merge branch 'develop' into logger
eddieliao 4c751bf
Fix tidy
eddieliao 7d99e29
Revert requirements.txt change
eddieliao 801d681
Use any_of instead of for loop
eddieliao 57423be
Suppress cppcheck false positives
eddieliao a41e04a
Update file logger tests, clean up other tests
eddieliao 4e37b23
Add redefine macro for windows localtime
eddieliao 15db01f
Spelling
eddieliao 5517df0
Address comments
eddieliao 366d508
Formatting
eddieliao 2444301
Licensing
eddieliao b5e1e7c
Address additional comments
eddieliao 6ae9a92
Fix tidy
eddieliao 3da51e2
Licensing
eddieliao c138b29
Formatting
eddieliao e87de59
Move logger parser init out of command.hpp
eddieliao c9461b8
Use local logger_opts variable instead
eddieliao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /* | ||
| * The MIT License (MIT) | ||
| * | ||
| * Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in | ||
| * all copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| * THE SOFTWARE. | ||
| */ | ||
| #include <migraphx/color.hpp> | ||
| #include <sstream> | ||
|
|
||
| #ifndef _WIN32 | ||
| #include <unistd.h> | ||
| #endif | ||
|
|
||
| namespace migraphx { | ||
| inline namespace MIGRAPHX_INLINE_NS { | ||
|
|
||
| std::ostream& operator<<(std::ostream& os, const color& c) | ||
| { | ||
| #ifndef _WIN32 | ||
| int fd = -1; | ||
| if(&os == &std::cout) | ||
| fd = STDOUT_FILENO; | ||
| else if(&os == &std::cerr) | ||
| fd = STDERR_FILENO; | ||
| if(fd != -1 and isatty(fd) != 0) | ||
| return os << "\033[" << static_cast<std::size_t>(c) << "m"; | ||
| #else | ||
| (void)c; | ||
| #endif | ||
| return os; | ||
| } | ||
|
|
||
| std::string colorize(color c, const std::string& s) | ||
| { | ||
| std::stringstream ss; | ||
| ss << c << s << color::reset; | ||
| return ss.str(); | ||
| } | ||
|
|
||
| } // namespace MIGRAPHX_INLINE_NS | ||
| } // namespace migraphx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.