CTS-SAT-1-OBC-Firmware
Loading...
Searching...
No Matches
log.h File Reference
#include <stdint.h>
Include dependency graph for log.h:

Go to the source code of this file.

Macros

#define LOG_FORMATTED_MESSAGE_MAX_LENGTH   185
 

Enumerations

enum  LOG_severity_enum_t {
  LOG_SEVERITY_DEBUG = 1 << 0 , LOG_SEVERITY_NORMAL = 1 << 1 , LOG_SEVERITY_WARNING = 1 << 2 , LOG_SEVERITY_ERROR = 1 << 3 ,
  LOG_SEVERITY_CRITICAL = 1 << 4
}
 
enum  LOG_sink_enum_t {
  LOG_SINK_NONE = 0 , LOG_SINK_UHF_RADIO = 1 << 0 , LOG_SINK_FILE = 1 << 1 , LOG_SINK_UMBILICAL_UART = 1 << 2 ,
  LOG_SINK_UNKNOWN = 1 << 3 , LOG_SINK_ALL = (1 << 4) - 1
}
 
enum  { LOG_SINK_OFF = 0 , LOG_SINK_ON = 1 }
 
enum  LOG_system_enum_t {
  LOG_SYSTEM_OBC = 1 << 0 , LOG_SYSTEM_UHF_RADIO = 1 << 1 , LOG_SYSTEM_UMBILICAL_UART = 1 << 2 , LOG_SYSTEM_GNSS = 1 << 3 ,
  LOG_SYSTEM_MPI = 1 << 4 , LOG_SYSTEM_EPS = 1 << 5 , LOG_SYSTEM_BOOM = 1 << 6 , LOG_SYSTEM_ADCS = 1 << 7 ,
  LOG_SYSTEM_LFS = 1 << 8 , LOG_SYSTEM_FLASH = 1 << 9 , LOG_SYSTEM_ANTENNA_DEPLOY = 1 << 10 , LOG_SYSTEM_LOG = 1 << 11 ,
  LOG_SYSTEM_TELECOMMAND = 1 << 12 , LOG_SYSTEM_UNIT_TEST = 1 << 13 , LOG_SYSTEM_UNKNOWN = 1 << 14 , LOG_SYSTEM_ALL = (1 << 15) - 1
}
 
enum  LOG_context_enum_t { LOG_CONTEXT_AUTONOMOUS , LOG_CONTEXT_IMMEDIATE_TELECOMMAND , LOG_CONTEXT_SCHEDULED_TELECOMMAND }
 
enum  { LOG_SYSTEM_OFF = 0 , LOG_SYSTEM_ON = 1 }
 

Functions

void LOG_message (LOG_system_enum_t source, LOG_severity_enum_t severity, uint32_t sink_mask, const char fmt[],...) __attribute__((format(printf
 
void uint32_t LOG_all_sinks_except (uint32_t exceptions)
 Returns all sinks, except the specified exceptions.
 
uint8_t LOG_is_sink_enabled (LOG_sink_enum_t sink)
 Check logging sink status.
 
void LOG_set_sink_debugging_messages_enabled_state (LOG_sink_enum_t sink, uint8_t state)
 Turn debugging messages on or off for the specified sink.
 
void LOG_set_system_debugging_messages_enabled_state (LOG_system_enum_t system, uint8_t state)
 Turn debugging messages on or off for the specified system.
 
uint8_t LOG_is_system_file_logging_enabled (LOG_system_enum_t system)
 Check whether file logging is enabled for a subsystem.
 
void LOG_set_system_severity_mask (LOG_system_enum_t system, uint32_t severity_mask)
 Set the logging severity bitfield mask for a subsystem.
 
void LOG_set_sink_enabled_state (LOG_sink_enum_t sink, uint8_t state)
 Enable or disable logging to a sink.
 
void LOG_set_system_file_logging_enabled_state (LOG_system_enum_t system, uint8_t state)
 Enable or disable logging to file for a subsystem.
 
void LOG_report_sink_enabled_state (LOG_sink_enum_t sinks)
 Report a sink's enabled state.
 
void LOG_report_system_file_logging_state (LOG_system_enum_t systems)
 Report a subsystem's file-logging state.
 
uint16_t LOG_number_of_logging_sinks (void)
 
uint16_t LOG_number_of_logging_systems (void)
 
const char * LOG_get_severity_name (LOG_severity_enum_t severity)
 Get the name of a severity enum.
 
uint8_t LOG_memory_table_max_entries (void)
 Get the size in entries of the in-memory log table.
 
uint8_t LOG_get_memory_table_index_of_most_recent_log_entry (void)
 Get the index of the most recent in-memory log message.
 
const char * LOG_get_memory_table_full_message_at_index (uint8_t index)
 Get a pointer to the full text of the in-memory log message at the specified index.
 

Variables

LOG_context_enum_t LOG_current_log_context
 

Macro Definition Documentation

◆ LOG_FORMATTED_MESSAGE_MAX_LENGTH

#define LOG_FORMATTED_MESSAGE_MAX_LENGTH   185

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
LOG_SYSTEM_OFF 
LOG_SYSTEM_ON 

◆ anonymous enum

anonymous enum
Enumerator
LOG_SINK_OFF 
LOG_SINK_ON 

◆ LOG_context_enum_t

Enumerator
LOG_CONTEXT_AUTONOMOUS 
LOG_CONTEXT_IMMEDIATE_TELECOMMAND 
LOG_CONTEXT_SCHEDULED_TELECOMMAND 

◆ LOG_severity_enum_t

Enumerator
LOG_SEVERITY_DEBUG 
LOG_SEVERITY_NORMAL 
LOG_SEVERITY_WARNING 
LOG_SEVERITY_ERROR 
LOG_SEVERITY_CRITICAL 

◆ LOG_sink_enum_t

Enumerator
LOG_SINK_NONE 
LOG_SINK_UHF_RADIO 
LOG_SINK_FILE 
LOG_SINK_UMBILICAL_UART 
LOG_SINK_UNKNOWN 
LOG_SINK_ALL 

◆ LOG_system_enum_t

Enumerator
LOG_SYSTEM_OBC 
LOG_SYSTEM_UHF_RADIO 
LOG_SYSTEM_UMBILICAL_UART 
LOG_SYSTEM_GNSS 
LOG_SYSTEM_MPI 
LOG_SYSTEM_EPS 
LOG_SYSTEM_BOOM 
LOG_SYSTEM_ADCS 
LOG_SYSTEM_LFS 
LOG_SYSTEM_FLASH 
LOG_SYSTEM_ANTENNA_DEPLOY 
LOG_SYSTEM_LOG 
LOG_SYSTEM_TELECOMMAND 
LOG_SYSTEM_UNIT_TEST 
LOG_SYSTEM_UNKNOWN 
LOG_SYSTEM_ALL 

Function Documentation

◆ LOG_all_sinks_except()

void uint32_t LOG_all_sinks_except ( uint32_t sink_exceptions_mask)

Returns all sinks, except the specified exceptions.

Parameters
exceptionsBitfield represent log sinks to exclude
Returns
Bitfield representing all log sinks, except those passed as an arg
Note
Especially useful in calls to LOG_message(), to report a failure of a specific logging sink.
Here is the caller graph for this function:

◆ LOG_get_memory_table_full_message_at_index()

const char * LOG_get_memory_table_full_message_at_index ( uint8_t index)

Get a pointer to the full text of the in-memory log message at the specified index.

Parameters
indexrequested in-memory log message
Returns
pointer to the full text of the log message
Here is the caller graph for this function:

◆ LOG_get_memory_table_index_of_most_recent_log_entry()

uint8_t LOG_get_memory_table_index_of_most_recent_log_entry ( void )

Get the index of the most recent in-memory log message.

Returns
index of the most recent log message
Here is the caller graph for this function:

◆ LOG_get_severity_name()

const char * LOG_get_severity_name ( LOG_severity_enum_t severity)

Get the name of a severity enum.

Parameters
severitythe specified severity
Returns
pointer to the statically allocated name
Here is the caller graph for this function:

◆ LOG_is_sink_enabled()

uint8_t LOG_is_sink_enabled ( LOG_sink_enum_t sink)

Check logging sink status.

Parameters
sinkthe sink to check
Returns
0: disabled (or invalid sink); 1: enabled
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LOG_is_system_file_logging_enabled()

uint8_t LOG_is_system_file_logging_enabled ( LOG_system_enum_t system)

Check whether file logging is enabled for a subsystem.

Parameters
system
Returns
returns 1 if logging to file is enabled, 0 otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LOG_memory_table_max_entries()

uint8_t LOG_memory_table_max_entries ( void )

Get the size in entries of the in-memory log table.

Returns
size of the in-memory log table
Here is the caller graph for this function:

◆ LOG_message()

void LOG_message ( LOG_system_enum_t source,
LOG_severity_enum_t severity,
uint32_t sink_mask,
const char fmt[],
... )
Here is the call graph for this function:

◆ LOG_number_of_logging_sinks()

uint16_t LOG_number_of_logging_sinks ( void )
Here is the caller graph for this function:

◆ LOG_number_of_logging_systems()

uint16_t LOG_number_of_logging_systems ( void )
Here is the caller graph for this function:

◆ LOG_report_sink_enabled_state()

void LOG_report_sink_enabled_state ( LOG_sink_enum_t sink)

Report a sink's enabled state.

Parameters
sinkspecified sink
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LOG_report_system_file_logging_state()

void LOG_report_system_file_logging_state ( LOG_system_enum_t system)

Report a subsystem's file-logging state.

Parameters
sinkspecified sink
Note
includes the subsystem's log filename
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LOG_set_sink_debugging_messages_enabled_state()

void LOG_set_sink_debugging_messages_enabled_state ( LOG_sink_enum_t sink,
uint8_t state )

Turn debugging messages on or off for the specified sink.

Parameters
sinkspecified sink
state0: debugging messages off; 1: debugging messages on

Turning off a sink's debugging messages overrides a system's debugging messages state

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LOG_set_sink_enabled_state()

void LOG_set_sink_enabled_state ( LOG_sink_enum_t sink,
uint8_t state )

Enable or disable logging to a sink.

Parameters
sinkspecified sink @state 0: disable 1: enable
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LOG_set_system_debugging_messages_enabled_state()

void LOG_set_system_debugging_messages_enabled_state ( LOG_system_enum_t system,
uint8_t state )

Turn debugging messages on or off for the specified system.

Parameters
systemspecified system
state0: debugging messages off; 1: debugging messages on

Debugging messages will be disabled if turned off for a given sink

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LOG_set_system_file_logging_enabled_state()

void LOG_set_system_file_logging_enabled_state ( LOG_system_enum_t system,
uint8_t state )

Enable or disable logging to file for a subsystem.

Parameters
systemspecified subsystem @state 0: disable 1: enable
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LOG_set_system_severity_mask()

void LOG_set_system_severity_mask ( LOG_system_enum_t system,
uint32_t severity_mask )

Set the logging severity bitfield mask for a subsystem.

Parameters
systemspecified system
severity_maskbitfield representing the severities to be logged
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ LOG_current_log_context

LOG_context_enum_t LOG_current_log_context
extern