Piping to Files Directly
If you're a developer, it can be handy to capture terminal output and a screen recording when you encounter a bug.
This guide will show you how to capture server logs, terminal output, or anything else in its raw format.
We'll be working in a *nix system with the tee
command.
Dashcam works by tailing log files for changes. Therefore, any newlines in a log file that Dashcam is configured to watch will appear in a Dashcam recording.
If your script already outputs logs to a file, configure Dashcam to monitor that file instead. See Log Files
1. Add an alias to your CLI profile
Add the dashcamlog
alias to your ~/.bashrc
or equivalent.
You may need to open a new terminal window for commands to work.
2. Log your process
Now, append dashcamlog
whenever you run a process from the terminal.
You can add this to your start script to ensure logs are always fed to Dashcam:
3. Configure Dashcam
Then, configure Dashcam to monitor /tmp/dashcam.log
and those log files will appear in the next Dashcam clip you make!
How it works
If your script outputs to stdout
and/or stderr
the best way to attach that output to Dashcam clips is with a command like the following:
Let's break down how this works. Stackoverflow post here.
node log-tester.js
is an example script that outputs to bothstdout
andstderr.
2>&1 routes both stdout
andstderr
into a single streamThe
|
command feeds the output intotee
.The
tee
command will route the output/tmp/dashcam.log
as well as in the terminal output
Last updated