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

force flush fatal and error logs #593

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Install packages
run: sudo apt-get install -y clang-format clang-format-15
run: |
sudo apt-get update
sudo apt-get install -y clang-format clang-format-15
- uses: actions/checkout@v3
with:
fetch-depth: 0
Expand Down
5 changes: 5 additions & 0 deletions src/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ void cvk_log(uint64_t group_mask, loglevel level, const char* fmt, ...) {
fprintf(gLoggingFile, "%s", colourReset);
}

// Force to flush error and fatal logs
if (level <= loglevel::error) {
fflush(gLoggingFile);
}

if (level == loglevel::fatal) {
exit(EXIT_FAILURE);
}
Expand Down
Loading