syslog_ng_common/logparser.rs
1// Copyright (c) 2016 Tibor Benke <ihrwein@gmail.com>
2//
3// Licensed under the Apache License, Version 2.0
4// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT
5// license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6// option. All files in the project carrying such notice may not be copied,
7// modified, or distributed except according to those terms.
8
9use syslog_ng_sys;
10use Pipe;
11use LogPipe;
12use LogMessage;
13
14pub struct LogParser(*mut syslog_ng_sys::LogParser);
15
16impl LogParser {
17 pub fn wrap_raw(raw: *mut syslog_ng_sys::LogParser) -> LogParser {
18 LogParser(raw)
19 }
20}
21
22impl Pipe for LogParser {
23 fn forward(&mut self, msg: LogMessage) {
24 let mut logpipe = LogPipe(self.0 as *mut syslog_ng_sys::LogPipe);
25 logpipe.forward(msg)
26 }
27}