| 1 |
|
| 2 |
#ifndef AWS_COMMON_LOG_WRITER_H |
| 3 |
#define AWS_COMMON_LOG_WRITER_H |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
#include <aws/common/common.h> |
| 11 |
|
| 12 |
AWS_PUSH_SANE_WARNING_LEVEL |
| 13 |
|
| 14 |
struct aws_allocator; |
| 15 |
struct aws_string; |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
struct aws_log_writer; |
| 24 |
|
| 25 |
typedef int(aws_log_writer_write_fn)(struct aws_log_writer *writer, const struct aws_string *output); |
| 26 |
typedef void(aws_log_writer_clean_up_fn)(struct aws_log_writer *writer); |
| 27 |
|
| 28 |
struct aws_log_writer_vtable { |
| 29 |
aws_log_writer_write_fn *write; |
| 30 |
aws_log_writer_clean_up_fn *clean_up; |
| 31 |
}; |
| 32 |
|
| 33 |
struct aws_log_writer { |
| 34 |
struct aws_log_writer_vtable *vtable; |
| 35 |
struct aws_allocator *allocator; |
| 36 |
void *impl; |
| 37 |
}; |
| 38 |
|
| 39 |
struct aws_log_writer_file_options { |
| 40 |
const char *filename; |
| 41 |
FILE *file; |
| 42 |
}; |
| 43 |
|
| 44 |
AWS_EXTERN_C_BEGIN |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
AWS_COMMON_API |
| 50 |
int aws_log_writer_init_stdout(struct aws_log_writer *writer, struct aws_allocator *allocator); |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
AWS_COMMON_API |
| 56 |
int aws_log_writer_init_stderr(struct aws_log_writer *writer, struct aws_allocator *allocator); |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
AWS_COMMON_API |
| 62 |
int aws_log_writer_init_file( |
| 63 |
struct aws_log_writer *writer, |
| 64 |
struct aws_allocator *allocator, |
| 65 |
struct aws_log_writer_file_options *options); |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
AWS_COMMON_API |
| 71 |
void aws_log_writer_clean_up(struct aws_log_writer *writer); |
| 72 |
|
| 73 |
AWS_EXTERN_C_END |
| 74 |
AWS_POP_SANE_WARNING_LEVEL |
| 75 |
|
| 76 |
#endif |