Pigweed
 
Loading...
Searching...
No Matches
handler.h
1// Copyright 2022 The Pigweed Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may not
4// use this file except in compliance with the License. You may obtain a copy of
5// the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12// License for the specific language governing permissions and limitations under
13// the License.
14#pragma once
15
16#include <stdarg.h>
17
18#include "pw_log_string/config.h"
19#include "pw_preprocessor/compiler.h"
20#include "pw_preprocessor/util.h"
21
22// This macro implements PW_LOG using pw_log_string_HandleMessage.
23//
24// This is the log macro frontend that funnels everything into the C-based
25// message hangler facade, i.e. pw_log_string_HandleMessage. It's not efficient
26// at the callsite, since it passes many arguments.
27//
28// Users can configure exactly what is passed to pw_log_string_HandleMessage by
29// providing their own PW_LOG_STRING_CONFIG_HANDLE_MESSAGE implementation.
30//
31#define PW_LOG_STRING_HANDLE_MESSAGE PW_LOG_STRING_CONFIG_HANDLE_MESSAGE
32
33PW_EXTERN_C_START
34
35// Invokes pw_log_string_HandleMessageVaList, this is implemented by the facade.
36void pw_log_string_HandleMessage(int level,
37 unsigned int flags,
38 const char* module_name,
39 const char* file_name,
40 int line_number,
41 const char* message,
42 ...) PW_PRINTF_FORMAT(6, 7);
43
46void pw_log_string_HandleMessageVaList(int level,
47 unsigned int flags,
48 const char* module_name,
49 const char* file_name,
50 int line_number,
51 const char* message,
52 va_list args);
53
54PW_EXTERN_C_END
#define PW_PRINTF_FORMAT(format_index, parameter_index)
Definition: compiler.h:86