// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using EpicGames.Horde.Agents.Leases;
using EpicGames.Horde.Agents.Sessions;
using EpicGames.Horde.Jobs;
#pragma warning disable CA2227 // Change 'Lines' to be read-only by removing the property setter
namespace EpicGames.Horde.Logs
{
///
/// The type of data stored in this log file
///
public enum LogType
{
///
/// Plain text data
///
Text,
///
/// Structured json objects, output as one object per line (without trailing commas)
///
Json
}
///
/// Creates a new log file
///
public class CreateLogRequest
{
///
/// Type of the log file
///
public LogType Type { get; set; } = LogType.Json;
}
///
/// Response from creating a log file
///
public class CreateLogResponse
{
///
/// Identifier for the created log file
///
public string Id { get; set; } = String.Empty;
}
///
/// Response describing a log file
///
public class GetLogResponse
{
///
/// Unique id of the log file
///
public LogId Id { get; set; }
///
/// Unique id of the job for this log file
///
public JobId JobId { get; set; }
///
/// The lease allowed to write to this log
///
public LeaseId? LeaseId { get; set; }
///
/// The session allowed to write to this log
///
public SessionId? SessionId { get; set; }
///
/// Type of events stored in this log
///
public LogType Type { get; set; }
///
/// Number of lines in the file
///
public int LineCount { get; set; }
}
///
/// Response describing a log file
///
public class SearchLogResponse
{
///
/// List of line numbers containing the search text
///
public List Lines { get; set; } = new List();
///
/// Stats for the search
///
public SearchStats? Stats { get; set; }
}
///
/// Response when querying for specific lines from a log file
///
public class LogLinesResponse
{
///
/// start index of the lines returned
///
public int Index { get; set; }
///
/// Number of lines returned
///
public int Count { get; set; }
///
/// Last index of the returned messages
///
public int MaxLineIndex { get; set; }
///
/// Type of response, Json or Text
///
public LogType Format { get; set; }
///
/// List of lines received
///
public List Lines { get; set; } = new List();
}
///
/// Response object for individual lines
///
public class LogLineResponse
{
///
/// Timestamp for log line
///
public DateTime Time { get; set; }
///
/// Level of Message (Information, Warning, Error)
///
public string? Level { get; set; }
///
/// Message itself
///
public string? Message { get; set; }
///
/// Format string for the message
///
public string? Format { get; set; }
///
/// User-defined properties for this jobstep.
///
public Dictionary? Properties { get; set; }
}
}