Skip to main content

windmill_api/models/
log_search_hit.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.800.1
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct LogSearchHit {
16    /// timestamp of the log line itself, not of the file containing it
17    #[serde(rename = "ts")]
18    pub ts: String,
19    #[serde(rename = "host")]
20    pub host: String,
21    #[serde(rename = "level")]
22    pub level: Level,
23    /// the tracing target that emitted the line
24    #[serde(rename = "target", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25    pub target: Option<Option<String>>,
26    #[serde(rename = "message")]
27    pub message: String,
28    /// the log file the line came from
29    #[serde(rename = "file_path")]
30    pub file_path: String,
31    /// offset of the line within its file
32    #[serde(rename = "line_no")]
33    pub line_no: i32,
34}
35
36impl LogSearchHit {
37    pub fn new(ts: String, host: String, level: Level, message: String, file_path: String, line_no: i32) -> LogSearchHit {
38        LogSearchHit {
39            ts,
40            host,
41            level,
42            target: None,
43            message,
44            file_path,
45            line_no,
46        }
47    }
48}
49/// 
50#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
51pub enum Level {
52    #[serde(rename = "TRACE")]
53    Trace,
54    #[serde(rename = "DEBUG")]
55    Debug,
56    #[serde(rename = "INFO")]
57    Info,
58    #[serde(rename = "WARN")]
59    Warn,
60    #[serde(rename = "ERROR")]
61    Error,
62}
63
64impl Default for Level {
65    fn default() -> Level {
66        Self::Trace
67    }
68}
69