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_HTTP, 1),
54 
56  = _az_LOG_MAKE_CLASSIFICATION(_az_FACILITY_HTTP, 2),
57 
58  AZ_LOG_HTTP_RETRY = _az_LOG_MAKE_CLASSIFICATION(
59  _az_FACILITY_HTTP,
60  3),
61 };
62 
70 typedef void (*az_log_message_fn)(az_log_classification classification, az_span message);
71 
78 #ifndef AZ_NO_LOGGING
80 #else
81 AZ_INLINE void az_log_set_message_callback(az_log_message_fn log_message_callback)
82 {
83  (void)log_message_callback;
84 }
85 #endif // AZ_NO_LOGGING
86 
87 #include <azure/core/_az_cfg_suffix.h>
88 
89 #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 write in order to rec...
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_set_message_callback
void az_log_set_message_callback(az_log_message_fn log_message_callback)
Sets the function that will be invoked to report an SDK log message.
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