LogsWriter returns an io.WriteCloser that sends logs via the provided sender. The sender is expected to be non-blocking. Calling Close flushes any remaining partially written log lines but is otherwise no-op. If the context passed to LogsWriter is canceled, any remaining logs will be discarded. Nei
(ctx context.Context, sender func(ctx context.Context, log ...Log) error, source uuid.UUID, level codersdk.LogLevel)
| 95 | // Neither Write nor Close is safe for concurrent use and must be used |
| 96 | // by a single goroutine. |
| 97 | func LogsWriter(ctx context.Context, sender func(ctx context.Context, log ...Log) error, source uuid.UUID, level codersdk.LogLevel) io.WriteCloser { |
| 98 | return &startupLogsWriter{ |
| 99 | ctx: ctx, |
| 100 | send: sender, |
| 101 | level: level, |
| 102 | source: source, |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | // LogsSenderFlushTimeout changes the default flush timeout (250ms), |
| 107 | // this is mostly useful for tests. |
no outgoing calls