Skip to content

Commit

Permalink
feat(enterprise): include log level when streaming
Browse files Browse the repository at this point in the history
We now include the log level of streamed log entries sent from
`BufferedEventSream`.
  • Loading branch information
thsig authored and eysi09 committed Jun 26, 2020
1 parent 35a175b commit 3e88a03
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions garden-service/src/enterprise/buffered-event-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { LogEntryMetadata, LogEntry } from "../logger/log-entry"
import { chainMessages } from "../logger/renderers"
import { got } from "../util/http"
import { makeAuthHeader } from "./auth"
import { LogLevel } from "../logger/log-node"

const workflowRunUid = process.env.GARDEN_WORKFLOW_RUN_UID || null

Expand All @@ -27,19 +28,20 @@ export interface LogEntryEvent {
revision: number
msg: string | string[]
timestamp: Date
level: LogLevel
data?: any
section?: string
metadata?: LogEntryMetadata
}

export function formatForEventStream(entry: LogEntry): LogEntryEvent {
const { section, data } = entry.getMessageState()
const { key, revision } = entry
const { key, revision, level } = entry
const parentKey = entry.parent ? entry.parent.key : null
const metadata = entry.getMetadata()
const msg = chainMessages(entry.getMessageStates() || [])
const timestamp = new Date()
return { key, parentKey, revision, msg, data, metadata, section, timestamp }
return { key, parentKey, revision, msg, data, metadata, section, timestamp, level }
}

export const FLUSH_INTERVAL_MSEC = 1000
Expand Down

0 comments on commit 3e88a03

Please sign in to comment.