reactor-c
C Runtime for Lingua Franca
|
#include "util.h"
#include "environment.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <stdarg.h>
#include <time.h>
#include <stdbool.h>
Macros | |
#define | NUMBER_OF_FEDERATES 1 |
#define | SOCKET_READ_RETRY_INTERVAL 1000000 |
Functions | |
int | lf_fed_id () |
void | _lf_message_print (int is_error, const char *prefix, const char *format, va_list args, int log_level) ATTRIBUTE_FORMAT_PRINTF(3 |
void | lf_print (const char *format,...) |
void | lf_vprint (const char *format, va_list args) |
void | lf_print_log (const char *format,...) |
void | lf_vprint_log (const char *format, va_list args) |
void | lf_print_debug (const char *format,...) |
void | lf_vprint_debug (const char *format, va_list args) |
void | lf_print_error (const char *format,...) |
void | lf_vprint_error (const char *format, va_list args) |
void | lf_print_warning (const char *format,...) |
void | lf_vprint_warning (const char *format, va_list args) |
void | lf_print_error_and_exit (const char *format,...) |
void | lf_vprint_error_and_exit (const char *format, va_list args) |
void | lf_register_print_function (print_message_function_t *function, int log_level) |
Variables | |
int | _lf_my_fed_id = -1 |
print_message_function_t * | print_message_function = NULL |
int | print_message_level = -1 |
Copyright (c) 2020, The University of California at Berkeley.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Utility functions for managing output the user, error and warning messages, logging, and debug messages. Outputs are filtered based on the target "logging" parameter.
#define NUMBER_OF_FEDERATES 1 |
#define SOCKET_READ_RETRY_INTERVAL 1000000 |
Number of nanoseconds to sleep before retrying a socket read.
void void _lf_message_print | ( | int | is_error, |
const char * | prefix, | ||
const char * | format, | ||
va_list | args, | ||
int | log_level | ||
) |
Internal implementation of the next few reporting functions.
void lf_register_print_function | ( | print_message_function_t * | function, |
int | log_level | ||
) |
Register a function to display messages. After calling this, all messages passed to the above print functions will be printed using the specified function rather than printf if their log level is greater than the specified level. The level should be one of LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, LOG_LEVEL_INFO, LOG_LEVEL_LOG, or LOG_LEVEL_DEBUG.
function | The print message function or NULL to revert to using printf. |
log_level | The level of messages to redirect. |
int _lf_my_fed_id = -1 |
The ID of this federate. For a non-federated execution, this will be -1. For a federated execution, it will be assigned in the generated code.
print_message_function_t* print_message_function = NULL |
If non-null, this function will be used instead of the printf to print messages.
int print_message_level = -1 |
The level of messages to redirect to print_message_function.