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

iox-#1755 Use upper camel case for LogLevel enum tags #2405

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
8 changes: 4 additions & 4 deletions .cirrus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ iox_run_tests_template: &IOX_RUN_TESTS

preflight_check_task:
container:
dockerfile: tools/ci/docker/ubuntu-22.04
dockerfile: tools/ci/docker/ubuntu-24.04
cpu: 1
memory: 4GB
<<: *IOX_TASK_TIMEOUT
Expand All @@ -114,13 +114,13 @@ preflight_check_task:
cmake_linter_script: tools/ci/cmake-linter.sh

#
# Ubuntu 22.04 aarch64
# Ubuntu 24.04 aarch64
#

ubuntu_22_04_aarch64_build_task:
depends_on: preflight_check
arm_container:
dockerfile: tools/ci/docker/ubuntu-22.04
dockerfile: tools/ci/docker/ubuntu-24.04
<<: *IOX_COMMON_CPU_AND_MEMORY_CONFIG_FOR_BUILDS
<<: *IOX_TASK_TIMEOUT
test_binaries_cache:
Expand All @@ -135,7 +135,7 @@ ubuntu_22_04_aarch64_build_task:
ubuntu_22_04_aarch64_test_task:
depends_on: ubuntu_22_04_aarch64_build
arm_container:
dockerfile: tools/ci/docker/ubuntu-22.04
dockerfile: tools/ci/docker/ubuntu-24.04
<<: *IOX_COMMON_CPU_AND_MEMORY_CONFIG_FOR_TESTS
<<: *IOX_TASK_TIMEOUT
test_binaries_cache:
Expand Down
12 changes: 6 additions & 6 deletions .github/actions/install-iceoryx-deps-and-clang/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ runs:
run: |
sudo dpkg --add-architecture i386
sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main"
sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main"
sudo apt-get update
sudo apt-get install -y libacl1-dev libncurses5-dev
sudo apt-get install -y libacl1-dev:i386 libc6-dev-i386 libc6-dev-i386-cross libstdc++6-i386-cross gcc-multilib g++-multilib
sudo apt-get install -y clang-format-15 clang-tidy-15 clang-tools-15 clang-15 lld
sudo apt-get install -y clang-format-18 clang-tidy-18 clang-tools-18 clang-18 lld
sudo rm /usr/bin/clang
sudo rm /usr/bin/clang++
sudo rm /usr/bin/clang-tidy
sudo rm /usr/bin/clang-format
sudo ln -s /usr/bin/clang-15 /usr/bin/clang
sudo ln -s /usr/bin/clang++-15 /usr/bin/clang++
sudo ln -s /usr/bin/clang-tidy-15 /usr/bin/clang-tidy
sudo ln -s /usr/bin/clang-format-15 /usr/bin/clang-format
sudo ln -s /usr/bin/clang-18 /usr/bin/clang
sudo ln -s /usr/bin/clang++-18 /usr/bin/clang++
sudo ln -s /usr/bin/clang-tidy-18 /usr/bin/clang-tidy
sudo ln -s /usr/bin/clang-format-18 /usr/bin/clang-format
18 changes: 9 additions & 9 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
pre-flight-check:
# prevent stuck jobs consuming runners for 6 hours
timeout-minutes: 60
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install iceoryx dependencies and clang-tidy
Expand All @@ -25,7 +25,7 @@ jobs:
- run: ./tools/ci/cmake-linter.sh

check-status-of-nightly-action:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: pre-flight-check
steps:
- name: Install dependencies
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
# prevent stuck jobs consuming runners for 6 hours
timeout-minutes: 60
needs: pre-flight-check
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Unix (FreeBSD) test
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
build-test-ubuntu-with-address-sanitizer-gcc-latest:
# prevent stuck jobs consuming runners for 1 hour
timeout-minutes: 60
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: pre-flight-check
steps:
- uses: egor-tensin/[email protected]
Expand All @@ -146,7 +146,7 @@ jobs:
build-test-ubuntu-with-address-sanitizer-clang-latest:
# prevent stuck jobs consuming runners for 1 hour
timeout-minutes: 60
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: pre-flight-check
steps:
- name: Checkout
Expand All @@ -169,7 +169,7 @@ jobs:
build-test-ubuntu-with-thread-sanitizer-clang-latest:
# prevent stuck jobs consuming runners for 3 hours
timeout-minutes: 180
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: pre-flight-check
steps:
- name: Checkout
Expand All @@ -182,7 +182,7 @@ jobs:
build-test-ubuntu-32-bit:
# prevent stuck jobs consuming runners for 6 hours
timeout-minutes: 60
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: pre-flight-check
steps:
- name: Checkout
Expand All @@ -204,7 +204,7 @@ jobs:
build-test-ubuntu-32-64-bit-mix-mode:
# prevent stuck jobs consuming runners for 6 hours
timeout-minutes: 60
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: pre-flight-check
steps:
- name: Checkout
Expand All @@ -217,7 +217,7 @@ jobs:
build-test-ubuntu-bazel:
# prevent stuck jobs consuming runners for 6 hours
timeout-minutes: 60
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: pre-flight-check
steps:
- name: Checkout
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
clang-tidy-review:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- name: Checkout
Expand All @@ -24,7 +24,7 @@ jobs:
run: ./tools/scripts/clang_tidy_check.sh scan_list .clang-tidy-diff-scans.txt "${{ steps.changed_files.outputs.added_modified }}"

check-for-todo:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- name: Checkout
Expand All @@ -36,7 +36,7 @@ jobs:
run: ./tools/ci/todo-verificator.sh

verify-links-in-markdown-documentation:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- run: ./tools/ci/build-test-macos.sh

clang-tidy-full-scan:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- name: Checkout
Expand Down
14 changes: 7 additions & 7 deletions doc/design/diagrams/logging/logging_classes.puml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
package building_blocks <<Frame>> {

enum LogLevel {
OFF = 0,
FATAL,
ERROR,
WARN,
INFO,
DEBUG,
TRACE,
Off = 0,
Fatal,
Error,
Warn,
Info,
Debug,
Trace,
}

class Logger <BaseLogger> {
Expand Down
64 changes: 32 additions & 32 deletions doc/design/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ variables, e.g. the log level.

| LogLevel | Usage |
|----------|-------|
| FATAL | For fatal and non-recoverable errors which essentially lead to termination of the program. |
| ERROR | For severe but recoverable errors. |
| WARN | For cases when something unintentional happens which is not considered a severe error. |
| INFO | Anything which could be relevant for the daily user. |
| DEBUG | Anything that is helpful for debugging, i.e. the info log level for the fellow developer. |
| TRACE | Anything that might be helpful for debugging in some cases but would be too verbose for debug log level. |

The log levels `FATAL`, `ERROR` and `WARN` should not be used independently but
| Fatal | For fatal and non-recoverable errors which essentially lead to termination of the program. |
| Error | For severe but recoverable errors. |
| Warn | For cases when something unintentional happens which is not considered a severe error. |
| Info | Anything which could be relevant for the daily user. |
| Debug | Anything that is helpful for debugging, i.e. the info log level for the fellow developer. |
| Trace | Anything that might be helpful for debugging in some cases but would be too verbose for debug log level. |

The log levels `Fatal`, `Error` and `Warn` should not be used independently but
in combination with the error handler and vice versa.

## Design
Expand Down Expand Up @@ -146,14 +146,14 @@ logger, independent of the active log level.

The `IOX_LOG_INTERNAL` calls `self()` on the `LogStream` instance to create an lvalue
reference to the `LogStream` instance. This eases the implementation of logging
support for custom types since `IOX_LOG(INFO, myType);` would require to implement
an overload with a rvalue `LogStream` reference but `IOX_LOG(INFO, "#### " << myType);`
support for custom types since `IOX_LOG(Info, myType);` would require to implement
an overload with a rvalue `LogStream` reference but `IOX_LOG(Info, "#### " << myType);`
requires a lvalue reference.

#### Behavior before calling Logger::init

In order to have log messages before `Logger::init` is called, the default logger
is used with `LogLevel::INFO`. It is up to the implementation of the default
is used with `LogLevel::Info`. It is up to the implementation of the default
logger what to do with these messages. For iceoryx the default logger is the
`ConsoleLogger` (this can be changed via the platform abstraction) which will
print the log messages to the console.
Expand Down Expand Up @@ -269,11 +269,11 @@ This is the sequence diagram of the setup of the testing logger:
The behavior of the logger can be altered via environment variables and the
`Logger::init` function. Calling this function without arguments, it will check
whether the environment variable `IOX_LOG_LEVEL` is set and use that value or
`LogLevel::INFO` if the environment variable is not set. To have a different
`LogLevel::Info` if the environment variable is not set. To have a different
fallback log level, the `logLevelFromEnvOr` function can be used, e.g.

```cpp
iox::log::Logger::init(iox::log::logLevelFromEnvOr(iox::log::LogLevel::DEBUG));
iox::log::Logger::init(iox::log::logLevelFromEnvOr(iox::log::LogLevel::Debug));
```

If the logger shall not be altered via environment variables, `Logger::init` must
Expand Down Expand Up @@ -303,9 +303,9 @@ re-implemented via the platform abstraction.

int main()
{
iox::log::Logger::init(iox::log::logLevelFromEnvOr(iox::log::LogLevel::DEBUG));
iox::log::Logger::init(iox::log::logLevelFromEnvOr(iox::log::LogLevel::Debug));

IOX_LOG(DEBUG, "Hello World");
IOX_LOG(Debug, "Hello World");

return 0;
}
Expand Down Expand Up @@ -333,7 +333,7 @@ iox::log::LogStream& operator<<(iox::log::LogStream& stream, const MyType& m)
int main()
{
MyType m;
IOX_LOG(INFO, m);
IOX_LOG(Info, m);

return 0;
}
Expand All @@ -355,7 +355,7 @@ class MyLogger : public iox::log::Logger
{
static MyLogger myLogger;
iox::log::Logger::setActiveLogger(myLogger);
iox::log::Logger::init(iox::log::logLevelFromEnvOr(iox::log::LogLevel::INFO));
iox::log::Logger::init(iox::log::logLevelFromEnvOr(iox::log::LogLevel::Info));
}

private:
Expand All @@ -366,22 +366,22 @@ class MyLogger : public iox::log::Logger
iox::log::LogLevel logLevel) noexcept override
{
switch(logLevel) {
case iox::log::LogLevel::FATAL:
case iox::log::LogLevel::Fatal:
logString("💀: ");
break;
case iox::log::LogLevel::ERROR:
case iox::log::LogLevel::Error:
logString("🙈: ");
break;
case iox::log::LogLevel::WARN:
case iox::log::LogLevel::Warn:
logString("🙀: ");
break;
case iox::log::LogLevel::INFO:
case iox::log::LogLevel::Info:
logString("💘: ");
break;
case iox::log::LogLevel::DEBUG:
case iox::log::LogLevel::Debug:
logString("🐞: ");
break;
case iox::log::LogLevel::TRACE:
case iox::log::LogLevel::Trace:
logString("🐾: ");
break;
default:
Expand All @@ -399,12 +399,12 @@ int main()
{
MyLogger::init();

IOX_LOG(FATAL, "Whoops ... look, over there is a dead seagull flying!");
IOX_LOG(ERROR, "Oh no!");
IOX_LOG(WARN, "It didn't happen!");
IOX_LOG(INFO, "All glory to the hypnotoad!");
IOX_LOG(DEBUG, "I didn't do it!");
IOX_LOG(TRACE, "Row row row your boat!");
IOX_LOG(Fatal, "Whoops ... look, over there is a dead seagull flying!");
IOX_LOG(Error, "Oh no!");
IOX_LOG(Warn, "It didn't happen!");
IOX_LOG(Info, "All glory to the hypnotoad!");
IOX_LOG(Debug, "I didn't do it!");
IOX_LOG(Trace, "Row row row your boat!");

return 0;
}
Expand All @@ -420,9 +420,9 @@ int main()
log messages when the signal is raised? It might be necessary to wait for the
error handling refactoring before this can be done
- instead of having the `Logger::init()` static function with hidden default
parameter this could be replaced by `Logger::init(LogLevel::WARN)`,
`Logger::initFromEnvOr(LogLevel::WARN)` and a builder like
`Logger::customize().logLevelFromEnvOr(LogLevel::WARN).init()`
parameter this could be replaced by `Logger::init(LogLevel::Warn)`,
`Logger::initFromEnvOr(LogLevel::Warn)` and a builder like
`Logger::customize().logLevelFromEnvOr(LogLevel::Warn).init()`
- wrap `__FILE__`, `__LINE__` and `__FUNCTION__` into a `source_location` struct
- where should this struct be placed
- could also be used by `IOX_EXPECTS`, `IOX_ENSURES`
Loading
Loading