Azure SDK for Embedded C
az_log.h
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // SPDX-License-Identifier: MIT
3 
20 #ifndef _az_LOG_H
21 #define _az_LOG_H
22 
23 #include <azure/core/az_result.h>
24 #include <azure/core/az_span.h>
25 
26 #include <stdint.h>
27 
28 #include <azure/core/_az_cfg_prefix.h>
29 
37 typedef int32_t az_log_classification;
38 
39 // az_log_classification Bits:
40 // - 31 Always 0.
41 // - 16..30 Facility.
42 // - 0..15 Code.
43 
44 #define _az_LOG_MAKE_CLASSIFICATION(facility, code) \
45  ((az_log_classification)(((uint32_t)(facility) << 16U) | (uint32_t)(code)))
46 
51 {
53  = _az_LOG_MAKE_CLASSIFICATION(_az_FACILITY_CORE_HTTP, 1),
54 
56  = _az_LOG_MAKE_CLASSIFICATION(_az_FACILITY_CORE_HTTP, 2),
57 
58  AZ_LOG_HTTP_RETRY = _az_LOG_MAKE_CLASSIFICATION(
59  _az_FACILITY_CORE_HTTP,
60  3),
61 };
62 
70 typedef void (*az_log_message_fn)(az_log_classification classification, az_span message);
71 
81 
92 #ifndef AZ_NO_LOGGING
94 #else
95 AZ_INLINE void az_log_set_message_callback(az_log_message_fn log_message_callback)
96 {
97  (void)log_message_callback;
98 }
99 #endif // AZ_NO_LOGGING
100 
114 #ifndef AZ_NO_LOGGING
116  az_log_classification_filter_fn message_filter_callback);
117 #else
119  az_log_classification_filter_fn message_filter_callback)
120 {
121  (void)message_filter_callback;
122 }
123 #endif // AZ_NO_LOGGING
124 
125 #include <azure/core/_az_cfg_suffix.h>
126 
127 #endif // _az_LOG_H
az_result.h
Definition of az_result and helper functions.
az_log_message_fn
void(* az_log_message_fn)(az_log_classification classification, az_span message)
Defines the signature of the callback function that application developers must provide to receive Az...
Definition: az_log.h:70
AZ_LOG_HTTP_REQUEST
@ AZ_LOG_HTTP_REQUEST
HTTP request is about to be sent.
Definition: az_log.h:52
az_span.h
An az_span represents a contiguous byte buffer and is used for string manipulations,...
az_log_classification_core
az_log_classification_core
Identifies the az_log_classification produced by the SDK Core.
Definition: az_log.h:51
az_log_classification
int32_t az_log_classification
Identifies the classifications of log messages produced by the SDK.
Definition: az_log.h:37
az_log_classification_filter_fn
bool(* az_log_classification_filter_fn)(az_log_classification classification)
Defines the signature of the callback function that application developers must provide which will be...
Definition: az_log.h:80
az_log_set_message_callback
void az_log_set_message_callback(az_log_message_fn log_message_callback)
Sets the functions that will be invoked to report an SDK log message.
az_log_set_classification_filter_callback
void az_log_set_classification_filter_callback(az_log_classification_filter_fn message_filter_callback)
Sets the functions that will be invoked to check whether an SDK log message should be reported.
AZ_LOG_HTTP_RETRY
@ AZ_LOG_HTTP_RETRY
First HTTP request did not succeed and will be retried.
Definition: az_log.h:58
AZ_LOG_HTTP_RESPONSE
@ AZ_LOG_HTTP_RESPONSE
HTTP response was received.
Definition: az_log.h:55
az_span
Represents a "view" over a byte buffer that represents a contiguous region of memory....
Definition: az_span.h:33