armbian-next: logging: introduce RAW_LOG=yes to export .tar with raw unprocessed logs (for development)

This commit is contained in:
Ricardo Pardini 2023-02-02 13:12:00 +01:00
parent 3bcf89d6c6
commit ecbf09491d
No known key found for this signature in database
GPG Key ID: 3D38CA12A66C5D02
2 changed files with 18 additions and 0 deletions

View File

@ -174,3 +174,14 @@ function export_ansi_logs() {
return 0
}
function export_raw_logs() {
display_alert "Exporting RAW logs from" "${LOGDIR}" "info"
if [[ -z "${target_file}" ]]; then
display_alert "No target file specified for export_raw_logs()" "${target_file}" "err"
return 0
fi
# Just tar the logs directory into target_file
tar -C "${LOGDIR}" -cf "${target_file}" .
}

View File

@ -88,6 +88,13 @@ function trap_handler_cleanup_logging() {
reset_uid_owner "${target_file}"
local markdown_log_file="${target_file}"
# Export raw logs, in a tar. For development.
if [[ "${RAW_LOG:-no}" == "yes" ]]; then
local target_file="${target_path}/log-${ARMBIAN_LOG_CLI_ID}-${ARMBIAN_BUILD_UUID}.raw.tar"
export_raw_logs
reset_uid_owner "${target_file}"
fi
# If running in Github Actions, cat the markdown file to GITHUB_STEP_SUMMARY. It appends, docker and build logs will be together.
if [[ "${CI}" == "true" ]] && [[ "${GITHUB_ACTIONS}" == "true" ]]; then
display_alert "Exporting Markdown logs to GitHub Actions" "GITHUB_STEP_SUMMARY: '${GITHUB_STEP_SUMMARY}'" "info"