[Hardware OS log interface] Log file functions for HWOS. More...
Go to the source code of this file.
Enumerations | |
enum | hlog_flag { HLOG_ERROR, HLOG_WARNING, HLOG_NORMAL, HLOG_DEBUG } |
Definition of possible flags for log entries. | |
Functions | |
int | hlog_init () |
Open the log file for the HWOS. | |
void | hlog_write (enum hlog_flag flag, char *text) |
Write a flag and a string to the log file. | |
void | hlog_write_text (char *text) |
Write a string to the log file. | |
void | hlog_write_integer (int number) |
Write an integer to the log file. | |
void | hlog_close () |
Close the log file for the HWOS. |
[Hardware OS log interface] Log file functions for HWOS.
Functionality for writing to a log file. Writing to the log is mutual exclusive and thread safe.
Author (2011): Sindre Hansen
Definition in file hlog.h.
void hlog_close | ( | ) |
int hlog_init | ( | ) |
Open the log file for the HWOS.
void hlog_write | ( | enum hlog_flag | flag, | |
char * | text | |||
) |
Write a flag and a string to the log file.
flag | Flag to write. Could for example indicate an error or a warning. | |
text | Character array (string) to be written. |
Definition at line 19 of file hlog.c.
{ if (hlogfile == NULL) return; pthread_mutex_lock(&write_mutex); switch (flag) { case HLOG_ERROR: fprintf(hlogfile, "ERROR: "); break; case HLOG_WARNING: fprintf(hlogfile, "WARNING: "); break; case HLOG_NORMAL: fprintf(hlogfile, "NORMAL: "); break; case HLOG_DEBUG: fprintf(hlogfile, "DEBUG: "); break; default: fprintf(hlogfile, "UNKNOWN: "); break; } fprintf(hlogfile,"%s", text); fflush(hlogfile); pthread_mutex_unlock(&write_mutex); }
void hlog_write_integer | ( | int | number | ) |
void hlog_write_text | ( | char * | text | ) |