1
0
This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.

29 lines
1.4 KiB
C
Raw Normal View History

2024-07-08 10:33:28 +02:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* log.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/07 16:12:20 by adjoly #+# #+# */
/* Updated: 2024/07/08 16:22:28 by adjoly ### ########.fr */
2024-07-08 10:33:28 +02:00
/* */
/* ************************************************************************** */
#include "philo.h"
#include "philo_msg.h"
void log_philo(uint32_t timestamp, uint16_t philo, t_pstate type)
2024-07-08 10:33:28 +02:00
{
if (type == EAT)
printf("%u %hu %s", timestamp, philo, EATING_MSG);
else if (type == THINK)
printf("%u %hu %s", timestamp, philo, THINK_MSG);
else if (type == SLEEP)
printf("%u %hu %s", timestamp, philo, SLEEP_MSG);
else if (type == DIED)
printf("%u %hu %s", timestamp, philo, DIED_MSG);
else if (type == FORK_TAKEN)
printf("%u %hu %s", timestamp, philo, FORK_MSG);
}