fn to_lines(&self) -> (String, String) {
        let mut request = Vec::new();
        let mut reply = Vec::new();

        // This will never fail, but _if_ it does, it simply
        // puts in the time/date of Towelday 2019.
        let time = self.time.duration_since(UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(1558735200);
        let src_ip = match self.src_ip {
            IpAddr::V4(addr) => addr.to_string(),
            IpAddr::V6(addr) => addr.to_string(),
        };

        // request fields.
        request.push(time.to_string());
        request.push(src_ip.clone());
        request.push("1".to_string());
        request.push(attr_string(1, &self.username));
        request.push("2:\"\"".to_string());
        request.push(attr_item(4, &src_ip));
        if let Some(ref s) = self.callingsystem {
            request.push(attr_string(32, s));
        }
        if let Some(ref ip) = self.clientip {
            let ip = match ip {
                &IpAddr::V4(ref addr) => addr.to_string(),
                &IpAddr::V6(ref addr) => addr.to_string(),
            };
            request.push(attr_string(31, &ip));
        }

        // reply fields.
        reply.push(time.to_string());
        reply.push(src_ip);
        let reply_code = match self.status {
            Ok(_) => 2,
            Err(_) => 3,
        };
        reply.push(reply_code.to_string());
        if let Some(ref account) = self.account {
            if account != &self.username {
                reply.push(attr_string(1, account));
                reply.push(attr_xs401(25, account));
            }
        }
        // if no attrs pushed, add an empty attr (i.e. a comma).
        if reply.len() == 3 {
            reply.push("".to_string());
        }

        if let Err(ref e) = self.status {
            match self.message {
                Some(ref m) => reply.push(attr_string(24, m)),
                None => reply.push(attr_string(24, e.as_log_message())),
            }
            reply.push(attr_string(18, e.as_reply()));
        }

        // we're done.
        (request.as_slice().join(","), reply.as_slice().join(","))
    }
// Generate 2 lines in "datalog" format.
Generate 2 lines in "datalog" format.
Generate 2 lines in " datalog " format .
fn to_lines(&self) -> (String, String) {
        let mut request = Vec::new();
        let mut reply = Vec::new();
        // This will never fail, but _if_ it does, it simply
        // puts in the time/date of Towelday 2019.
        let time = self.time.duration_since(UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(1558735200);
        let src_ip = match self.src_ip {
            IpAddr::V4(addr) => addr.to_string(),
            IpAddr::V6(addr) => addr.to_string(),
        };
        // request fields.
        request.push(time.to_string());
        request.push(src_ip.clone());
        request.push("1".to_string());
        request.push(attr_string(1, &self.username));
        request.push("2:\"\"".to_string());
        request.push(attr_item(4, &src_ip));
        if let Some(ref s) = self.callingsystem {
            request.push(attr_string(32, s));
        }
        if let Some(ref ip) = self.clientip {
            let ip = match ip {
                &IpAddr::V4(ref addr) => addr.to_string(),
                &IpAddr::V6(ref addr) => addr.to_string(),
            };
            request.push(attr_string(31, &ip));
        }
        // reply fields.
        reply.push(time.to_string());
        reply.push(src_ip);
        let reply_code = match self.status {
            Ok(_) => 2,
            Err(_) => 3,
        };
        reply.push(reply_code.to_string());
        if let Some(ref account) = self.account {
            if account != &self.username {
                reply.push(attr_string(1, account));
                reply.push(attr_xs401(25, account));
            }
        }
        // if no attrs pushed, add an empty attr (i.e. a comma).
        if reply.len() == 3 {
            reply.push("".to_string());
        }
        if let Err(ref e) = self.status {
            match self.message {
                Some(ref m) => reply.push(attr_string(24, m)),
                None => reply.push(attr_string(24, e.as_log_message())),
            }
            reply.push(attr_string(18, e.as_reply()));
        }
        // we're done.
        (request.as_slice().join(","), reply.as_slice().join(","))
    }
fn to_lines ( & self ) -> ( String , String ) { let mut request = Vec :: new ( ) ; let mut reply = Vec :: new ( ) ; // This will never fail, but _if_ it does, it simply // puts in the time/date of Towelday 2019. let time = self . time . duration_since ( UNIX_EPOCH ) . map ( | d | d . as_secs ( ) ) . unwrap_or ( 1558735200 ) ; let src_ip = match self . src_ip { IpAddr :: V4 ( addr ) => addr . to_string ( ) , IpAddr :: V6 ( addr ) => addr . to_string ( ) , } ; // request fields. request . push ( time . to_string ( ) ) ; request . push ( src_ip . clone ( ) ) ; request . push ( " " . to_string ( ) ) ; request . push ( attr_string ( 1 , & self . username ) ) ; request . push ( " \" \" " . to_string ( ) ) ; request . push ( attr_item ( 4 , & src_ip ) ) ; if let Some ( ref s ) = self . callingsystem { request . push ( attr_string ( 32 , s ) ) ; } if let Some ( ref ip ) = self . clientip { let ip = match ip { & IpAddr :: V4 ( ref addr ) => addr . to_string ( ) , & IpAddr :: V6 ( ref addr ) => addr . to_string ( ) , } ; request . push ( attr_string ( 31 , & ip ) ) ; } // reply fields. reply . push ( time . to_string ( ) ) ; reply . push ( src_ip ) ; let reply_code = match self . status { Ok ( _ ) => 2 , Err ( _ ) => 3 , } ; reply . push ( reply_code . to_string ( ) ) ; if let Some ( ref account ) = self . account { if account != & self . username { reply . push ( attr_string ( 1 , account ) ) ; reply . push ( attr_xs401 ( 25 , account ) ) ; } } // if no attrs pushed, add an empty attr (i.e. a comma). if reply . len ( ) == 3 { reply . push ( " " . to_string ( ) ) ; } if let Err ( ref e ) = self . status { match self . message { Some ( ref m ) => reply . push ( attr_string ( 24 , m ) ) , None => reply . push ( attr_string ( 24 , e . as_log_message ( ) ) ) , } reply . push ( attr_string ( 18 , e . as_reply ( ) ) ) ; } // we're done. ( request . as_slice ( ) . join ( " " ) , reply . as_slice ( ) . join ( " " ) ) }
Generate 2 lines in "datalog" format.
Generate 2 lines in " datalog " format .
&self