- Object.keys(log).forEach(logKey => {
- if (logKey !== 'message' && logKey !== 'level') additionalInfo[logKey] = log[logKey]
+function toTimeFormat (time: string) {
+ const timestamp = Date.parse(time)
+
+ if (isNaN(timestamp) === true) return 'Unknown date'
+
+ return new Date(timestamp).toISOString()
+}
+
+// Thanks: https://stackoverflow.com/a/37014317
+function getNewestFile (files: string[], basePath: string) {
+ const out = []
+
+ files.forEach(file => {
+ const stats = statSync(basePath + '/' + file)
+ if (stats.isFile()) out.push({ file, mtime: stats.mtime.getTime() })