|
Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
|
An datatype to abstract out the process of writing log and error messages to the appropriate processes and places on a given Server. More...
#include <streams.h>
Public Member Functions | |
| void | FreeDefaultOutputStream (void) |
| Free the default OutputStreams. More... | |
| void | SetDefaultErrorStream (OutputStream *stream_p) |
| Set the Server-side OutputStream for printing error messages to. More... | |
| void | SetDefaultLogStream (OutputStream *stream_p) |
| Set the Server-side OutputStream for printing error messages to. More... | |
| void | FreeOutputStream (struct OutputStream *stream_p) |
| Free an OutputStream. More... | |
| int | PrintToOutputStream (OutputStream *stream_p, const char *const filename_s, const int line_number, const char *message_s,...) |
| Print to a given error OutputStream. More... | |
| int | PrintErrors (const uint32 level, const char *const filename_s, const int line_number, const char *message,...) |
| Print to the error OutputStream. More... | |
| int | PrintLog (const uint32 level, const char *const filename_s, const int line_number, const char *message_s,...) |
| Print to the log OutputStream. More... | |
| int | PrintErrorsVarArgs (const uint32 level, const char *const filename_s, const int line_number, const char *message_s, va_list args) |
| Print to the error OutputStream. More... | |
| int | PrintLogVarArgs (const uint32 level, const char *const filename_s, const int line_number, const char *message_s, va_list args) |
| Print to the log OutputStream. More... | |
| OutputStream * | GetLogOutput (void) |
| Get where logging messages will be sent. More... | |
| OutputStream * | GetErrorsOutput (void) |
| Get where error messages will be sent. More... | |
| bool | FlushOutputStream (OutputStream *stream_p) |
| Flush an OutputStream. More... | |
| bool | FlushLog (void) |
| Flush the logging OutputStream. More... | |
| bool | FlushErrors (void) |
| Flush the errors OutputStream. More... | |
Data Fields | |
| int(* | st_print_fn )(struct OutputStream *stream_p, const uint32 level, const char *const filename_s, const int line_number, const char *message_s, va_list args) |
| Print to an OutputStream. More... | |
| bool(* | st_flush_fn )(struct OutputStream *stream_p) |
| Flush any pending writes to an OutputStream. More... | |
| void(* | st_free_stream_fn )(struct OutputStream *stream_p) |
| Callback function to free the OutputStream if it needs any custom behaviour. More... | |
An datatype to abstract out the process of writing log and error messages to the appropriate processes and places on a given Server.
| void FreeDefaultOutputStream | ( | void | ) |
Free the default OutputStreams.
This should be called when stopping a Server.
| void SetDefaultErrorStream | ( | OutputStream * | stream_p | ) |
Set the Server-side OutputStream for printing error messages to.
| stream_p | The OutputStream to use. |
| void SetDefaultLogStream | ( | OutputStream * | stream_p | ) |
Set the Server-side OutputStream for printing error messages to.
| stream_p | The OutputStream to use. |
| void FreeOutputStream | ( | struct OutputStream * | stream_p | ) |
| int PrintToOutputStream | ( | OutputStream * | stream_p, |
| const char *const | filename_s, | ||
| const int | line_number, | ||
| const char * | message_s, | ||
| ... | |||
| ) |
Print to a given error OutputStream.
This will call st_print_fn.
| stream_p | The OutputStream to print to. |
| filename_s | The name of the file calling this function. |
| line_number | The line in the file from which this function was called. |
| message_s | A char * using the same format as printf, etc. |
| int PrintErrors | ( | const uint32 | level, |
| const char *const | filename_s, | ||
| const int | line_number, | ||
| const char * | message, | ||
| ... | |||
| ) |
Print to the error OutputStream.
If this has not previously been set, it will default to stderr.
| level | The stream level to use. |
| filename_s | The name of the file calling this function. |
| line_number | The line in the file from which this function was called. |
| message | A char * using the same format as printf, etc. |
| int PrintLog | ( | const uint32 | level, |
| const char *const | filename_s, | ||
| const int | line_number, | ||
| const char * | message_s, | ||
| ... | |||
| ) |
Print to the log OutputStream.
If this has not previously been set, it will default to stdout.
| level | The stream level to use. |
| filename_s | The name of the file calling this function. |
| line_number | The line in the file from which this function was called. |
| message_s | A char * using the same format as printf, etc. |
| int PrintErrorsVarArgs | ( | const uint32 | level, |
| const char *const | filename_s, | ||
| const int | line_number, | ||
| const char * | message_s, | ||
| va_list | args | ||
| ) |
Print to the error OutputStream.
If this has not previously been set, it will default to stderr.
| level | The stream level to use. |
| filename_s | The name of the file calling this function. |
| line_number | The line in the file from which this function was called. |
| message_s | A char * using the same format as printf, etc. |
| args | A va_list of the values to print. |
| int PrintLogVarArgs | ( | const uint32 | level, |
| const char *const | filename_s, | ||
| const int | line_number, | ||
| const char * | message_s, | ||
| va_list | args | ||
| ) |
Print to the log OutputStream.
If this has not previously been set, it will default to stdout.
| level | The stream level to use. |
| filename_s | The name of the file calling this function. |
| line_number | The line in the file from which this function was called. |
| message_s | A char * using the same format as printf, etc. |
| args | A va_list of the values to print. |
| OutputStream * GetLogOutput | ( | void | ) |
Get where logging messages will be sent.
| OutputStream * GetErrorsOutput | ( | void | ) |
Get where error messages will be sent.
| bool FlushOutputStream | ( | OutputStream * | stream_p | ) |
Flush an OutputStream.
| stream_p | The OutputStream to flush. |
true if the OutputStream was flushed successfully, falsse otherwise.| bool FlushLog | ( | void | ) |
Flush the logging OutputStream.
true if the logging OutputStream was flushed successfully, falsse otherwise.| bool FlushErrors | ( | void | ) |
Flush the errors OutputStream.
true if the errors OutputStream was flushed successfully, falsse otherwise.| int(* st_print_fn) (struct OutputStream *stream_p, const uint32 level, const char *const filename_s, const int line_number, const char *message_s, va_list args) |
Print to an OutputStream.
| stream_p | The OutputStream to print to. |
| level | The |
| message_s | The message to print. This can include the standard printf format specifiers. |
| args | Any arguments to match against the format specifiers. |
| bool(* st_flush_fn) (struct OutputStream *stream_p) |
Flush any pending writes to an OutputStream.
| stream_p | The OutputStream to flush |
true if the OutputStream was flushed succesfully, false otherwise. | void(* st_free_stream_fn) (struct OutputStream *stream_p) |
Callback function to free the OutputStream if it needs any custom behaviour.
| stream_p | The OutputStream to free. |