using System;
using Newtonsoft.Json;
namespace Unity.Pipeline.Models
{
///
/// Response model for the console command: a page of captured console entries plus
/// the cursor needed to fetch the next page.
///
[Serializable]
public class ConsoleLogResponse
{
///
/// The matching entries, oldest first, after applying the level filter, since cursor,
/// and tail limit.
///
[JsonProperty("entries")]
public ConsoleLogEntry[] Entries { get; set; }
///
/// The highest currently held in the buffer (regardless of
/// the level filter). A "--follow" client passes this back as since on the next poll
/// so it resumes exactly where it left off, even if the only new entries were filtered out.
/// Only meaningful paired with : sequence numbers restart from zero
/// with the capture session, so a cursor from an earlier session names different entries.
///
[JsonProperty("cursor")]
public long Cursor { get; set; }
///
/// Identifies the capture session belongs to. A "--follow" client
/// passes this back as since_session alongside since; a cursor from a
/// different session is refused rather than silently misapplied.
///
[JsonProperty("session")]
public string Session { get; set; }
///
/// Number of entries returned in .
///
[JsonProperty("returned")]
public int Returned { get; set; }
///
/// True when the requested since cursor pointed at entries that have already been
/// evicted from the bounded buffer, meaning the consumer missed some entries. Lets a
/// "--follow" client warn about a gap instead of silently skipping output. Also true
/// whenever is.
///
[JsonProperty("dropped")]
public bool Dropped { get; set; }
///
/// True when the requested cursor could not be honored — it came from another session, or
/// it was past the current counter — so the cursor was ignored and the tail returned
/// instead. A "--follow" client should adopt and
/// and treat the returned entries as a fresh start.
///
[JsonProperty("reset")]
public bool Reset { get; set; }
///
/// How many entries of each severity the buffer currently holds, before the level filter
/// and tail limit. Compare with and
/// friends to see whether the buffer is missing entries the Editor console still shows.
///
[JsonProperty("counts")]
public ConsoleLevelCounts Counts { get; set; }
///
/// Editor ground truth about the console at the time it was last sampled. Null in a player
/// build, and before the first sample after an Editor load.
///
[JsonProperty("groundTruth")]
public ConsoleGroundTruth GroundTruth { get; set; }
}
///
/// Entry counts per severity retained in the buffer, before the level filter and tail
/// limit are applied. Compare with the Editor console's own totals in
/// to see whether the buffer is missing entries the console
/// still shows.
///
[Serializable]
public class ConsoleLevelCounts
{
///
/// Retained entries at error severity. Unity's Error, Exception and Assert log types all
/// count here.
///
[JsonProperty("error")]
public int Error { get; set; }
/// Retained entries at warning severity.
[JsonProperty("warn")]
public int Warn { get; set; }
/// Retained entries at informational severity.
[JsonProperty("log")]
public int Log { get; set; }
}
}