From 16ff92dbb51cc51b6b9393f509d53d54835d43f0 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Fri, 4 Dec 2020 01:29:49 +0300 Subject: feat: add timestamp to logs --- src/components/EventCard/Logs.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/components/EventCard') diff --git a/src/components/EventCard/Logs.tsx b/src/components/EventCard/Logs.tsx index f508c16..d78fbd8 100644 --- a/src/components/EventCard/Logs.tsx +++ b/src/components/EventCard/Logs.tsx @@ -6,12 +6,17 @@ interface PropTypes { eventId: string; } +const DATE_OPTIONS = { dateStyle: 'short' }; const Logs: React.FC = ({ eventId }) => { const { data: logs } = useEventLogs(eventId); - const logString = '```\n' + logs?.map(log => log.message).join('\n') + '\n```'; - return ; + const logString = logs?.map(log => { + const timestamp = new Date(log.createdAt).toLocaleTimeString(); + return `[${timestamp}] ${log.message}`; + }).join('\n'); + + return ; }; export default Logs; -- cgit v1.2.3