summaryrefslogtreecommitdiffstats
path: root/hw2/logger.h
blob: e16bb3f007805e22f4f13a1c2808727b3ad98863 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef COMP135_LOGGER_H
#define COMP135_LOGGER_H

#include <stdbool.h>
#include <stdio.h>
#include <sys/types.h>

typedef struct {
    char* name;    /* Constant: DO NOT free it! */
    pid_t pid;
    char* log;
    int   log_fd;
    FILE* log_file;
    int   debug : 1;
    int   is_term : 1;
} Comp135;

void comp135_init (Comp135* comp, const char* static_name, bool no_init);
void comp135_destroy (Comp135* comp);
void comp135_log (Comp135* comp, const char* format, ...);

#endif /* COMP135_LOGGER_H */