mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-07 21:28:21 +00:00
add log streams
This commit is contained in:
@@ -12,7 +12,7 @@ use crate::{
|
||||
types::{
|
||||
self, CreateNamespaceVars, DeployApp, DeployAppConnection, DeployAppVersion,
|
||||
DeployAppVersionConnection, GetDeployAppAndVersion, GetDeployAppVersionsVars,
|
||||
GetNamespaceAppsVars, Log, PackageVersionConnection, PublishDeployAppVars,
|
||||
GetNamespaceAppsVars, Log, LogStream, PackageVersionConnection, PublishDeployAppVars,
|
||||
},
|
||||
GraphQLApiFailure, WasmerClient,
|
||||
};
|
||||
@@ -679,6 +679,7 @@ fn get_app_logs(
|
||||
start: OffsetDateTime,
|
||||
end: Option<OffsetDateTime>,
|
||||
watch: bool,
|
||||
streams: Option<Vec<LogStream>>,
|
||||
) -> impl futures::Stream<Item = Result<Vec<Log>, anyhow::Error>> + '_ {
|
||||
// Note: the backend will limit responses to a certain number of log
|
||||
// messages, so we use try_unfold() to keep calling it until we stop getting
|
||||
@@ -696,6 +697,7 @@ fn get_app_logs(
|
||||
first: Some(10),
|
||||
starting_from: unix_timestamp(start),
|
||||
until: end.map(unix_timestamp),
|
||||
streams: streams.clone(),
|
||||
};
|
||||
|
||||
let fut = async move {
|
||||
@@ -766,8 +768,9 @@ pub async fn get_app_logs_paginated(
|
||||
start: OffsetDateTime,
|
||||
end: Option<OffsetDateTime>,
|
||||
watch: bool,
|
||||
streams: Option<Vec<LogStream>>,
|
||||
) -> impl futures::Stream<Item = Result<Vec<Log>, anyhow::Error>> + '_ {
|
||||
let stream = get_app_logs(client, name, owner, tag, start, end, watch);
|
||||
let stream = get_app_logs(client, name, owner, tag, start, end, watch, streams);
|
||||
|
||||
stream.map(|res| {
|
||||
let mut logs = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user