| 72 | } |
| 73 | |
| 74 | void foo([[maybe_unused]] int value, bool use_legacy_api) { |
| 75 | if (use_legacy_api) { |
| 76 | CAF_LOG_TRACE(CAF_ARG(value)); |
| 77 | CAF_LOG_DEBUG("this is a debug message"); |
| 78 | CAF_LOG_DEBUG("this is another debug message with foobar(\"one\", \"two\") " |
| 79 | "; field = foobar(\"three\", \"four\")"); |
| 80 | CAF_LOG_INFO("this is an info message"); |
| 81 | CAF_LOG_INFO("this is another info message ; foo = bar"); |
| 82 | CAF_LOG_WARNING("this is a warning message"); |
| 83 | CAF_LOG_WARNING("this is another warning message ; foo = bar"); |
| 84 | CAF_LOG_ERROR("this is an error message"); |
| 85 | CAF_LOG_ERROR("this is another error message ; foo = bar"); |
| 86 | } else { |
| 87 | using caf::logger; |
| 88 | auto trace_guard = logger::trace(app::component, "value = {}", value); |
| 89 | app::debug("this is a debug message"); |
| 90 | app::debug() |
| 91 | .message("this is {} with {}", "another debug message", |
| 92 | foobar{"one", "two"}) |
| 93 | .field("field", "{}", foobar{"three", "four"}) |
| 94 | .send(); |
| 95 | app::info("this is an info message"); |
| 96 | app::info() |
| 97 | .message("this is {}", "another info message") |
| 98 | .field("foo", "bar") |
| 99 | .send(); |
| 100 | app::warning("this is a warning message"); |
| 101 | app::warning() |
| 102 | .message("this is {}", "another warning message") |
| 103 | .field("foo", "bar") |
| 104 | .send(); |
| 105 | app::error("this is an error message"); |
| 106 | app::error() |
| 107 | .message("this is {}", "another error message") |
| 108 | .field("foo", "bar") |
| 109 | .send(); |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | class config : public caf::actor_system_config { |
| 114 | public: |