[][src]Struct serde_gelf::GelfRecord

pub struct GelfRecord { /* fields omitted */ }

Structure which represent a log record.

Trait Implementations

impl GelfRecordBuilder for GelfRecord[src]

fn new() -> GelfRecord[src]

Construct new GelfRecord.

fn set_message(self, short_message: String) -> Self[src]

Set GelfRecord.short_message.

fn set_level(self, level: GelfLevel) -> Self[src]

Set GelfRecord.level.

fn set_timestamp(self, timestamp: f64) -> Self[src]

Set GelfRecord.timestamp.

Example


use serde_gelf::GelfRecord;
use std::time::{SystemTime, UNIX_EPOCH};

let rec = GelfRecord::new()
    .set_timestamp({
        let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
         now.as_secs() as f64 + f64::from(now.subsec_nanos()) / 1e9
});

fn add_additional_fields(
    self,
    additional_fields: BTreeMap<Value, Value>
) -> Self
[src]

Extend a already flatten dict to GelfRecord.additional_fields.

Example

use std::collections::BTreeMap;
use serde_gelf::{GelfRecord, GelfLevel, to_flat_dict};

let mut extra = BTreeMap::new();
extra.insert("integer".into(),  serde_value::Value::I8(10));

let rec = GelfRecord::new()
    .extend_additional_fields(to_flat_dict(&extra).unwrap());

fn extend_additional_fields(
    self,
    additional_fields: BTreeMap<Value, Value>
) -> Self
[src]

Extend a already flatten dict to GelfRecord.additional_fields.

Example

use std::collections::BTreeMap;
use serde_gelf::{GelfRecord, GelfLevel, to_flat_dict};

let mut extra = BTreeMap::new();
extra.insert("integer".into(),  serde_value::Value::I8(10));

let rec = GelfRecord::new()
    .extend_additional_fields(to_flat_dict(&extra).unwrap());

fn set_facility(self, facility: String) -> Self[src]

Set GelfRecord.facility.

fn set_line(self, line: u32) -> Self[src]

Set GelfRecord.line.

fn set_file(self, file: String) -> Self[src]

Set GelfRecord.file.

fn set_full_message(self, full_message: Option<String>) -> Self[src]

Set GelfRecord.full_message.

impl GelfRecordGetter for GelfRecord[src]

fn message(&self) -> String[src]

Return the GelfRecord.message attribute.

fn timestamp(&self) -> f64[src]

Return the GelfRecord.timestamp attribute.

fn level(&self) -> GelfLevel[src]

Return the GelfRecord.level attribute.

fn additional_fields(&self) -> BTreeMap<Value, Value>[src]

Return the GelfRecord.additional_fields attribute.

fn facility(&self) -> String[src]

Return the GelfRecord.facility attribute.

fn line(&self) -> u32[src]

Return the GelfRecord.lineattribute.

fn file(&self) -> String[src]

Return the GelfRecord.file attribute.

fn version() -> &'static str[src]

Return the GelfRecord.version attribute.

fn full_message(&self) -> Option<String>[src]

Return the GelfRecord.full_message attribute.

impl<'a, '_> From<&'_ Record<'a>> for GelfRecord[src]

impl<'_, R: GelfRecordGetter> From<&'_ R> for GelfRecord[src]

impl Clone for GelfRecord[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for GelfRecord[src]

impl Serialize for GelfRecord[src]

Auto Trait Implementations

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]