feat: add level support for startup logs (#7067)

This allows external services like our devcontainer support to display
errors and warnings with custom styles to indicate failures to users.
This commit is contained in:
Kyle Carberry
2023-04-10 14:29:59 -05:00
committed by GitHub
parent aa2468b16e
commit 81e2b2500a
17 changed files with 89 additions and 26 deletions

View File

@ -151,11 +151,12 @@ WITH new_length AS (
startup_logs_length = startup_logs_length + @output_length WHERE workspace_agents.id = @agent_id
)
INSERT INTO
workspace_agent_startup_logs
workspace_agent_startup_logs (agent_id, created_at, output, level)
SELECT
@agent_id :: uuid AS agent_id,
unnest(@created_at :: timestamptz [ ]) AS created_at,
unnest(@output :: VARCHAR(1024) [ ]) AS output
unnest(@output :: VARCHAR(1024) [ ]) AS output,
unnest(@level :: log_level [ ]) AS level
RETURNING workspace_agent_startup_logs.*;
-- If an agent hasn't connected in the last 7 days, we purge it's logs.