-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ci: run tests for GB locale Signed-off-by: Miroslav Bajtoš <[email protected]> * store timestamps as iso strings * output human readable strings * `isHumanReadable` -> `pretty` * undo change * `date` -> `timestamp` everywhere * refactor * de-trick-ify --------- Signed-off-by: Miroslav Bajtoš <[email protected]> Co-authored-by: Julian Gruber <[email protected]>
- Loading branch information
1 parent
9df5a64
commit 4e56d9f
Showing
6 changed files
with
52 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
import { followLogs, getLatestLogs } from '../lib/log.js' | ||
import { followLogs, getLatestLogs, parseLog, formatLog } from '../lib/log.js' | ||
|
||
export const logs = async ({ module, follow }) => { | ||
if (follow) { | ||
for await (const line of followLogs(module)) { | ||
console.log(line) | ||
const { text, timestamp } = parseLog(line) | ||
process.stdout.write(formatLog(text, { timestamp, pretty: true })) | ||
} | ||
} else { | ||
process.stdout.write(await getLatestLogs(module)) | ||
const lines = (await getLatestLogs(module)) | ||
.toString() | ||
.trim() | ||
.split('\n') | ||
.filter(line => line !== '') | ||
for (const line of lines) { | ||
const { text, timestamp } = parseLog(line) | ||
process.stdout.write(formatLog(text, { timestamp, pretty: true })) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters