-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.h
23 lines (21 loc) · 612 Bytes
/
logger.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef LOGGER_H
#define LOGGER_H
#include <time.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <sys/stat.h>
#define FILE_MODE 0777
#define TIME_STR_MAX_LEN 32
#define MAX_PATHNAME_LEN 50
void log_command(char *command, int childId);
char *current_time_string();
void tidy_time_str(char *time_str);
int open_file(char *time_str, char *buffer);
void set_path(char *path, char *time_str, char *buffer);
void check_path_exist();
void write_to_file(int log_fd, char *time_str, char *buffer, int childId, char *command);
void close_file(int fd);
#endif