FluentLogger sample for GR-PEACH
Dependencies: EthernetInterface FluentLogger
main.cpp@0:5edb05436aa5, 2015-01-10 (annotated)
- Committer:
- YuuichiAkagawa
- Date:
- Sat Jan 10 07:59:12 2015 +0000
- Revision:
- 0:5edb05436aa5
- Child:
- 1:0a8269ab9a47
commit for publish;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
YuuichiAkagawa | 0:5edb05436aa5 | 1 | /* FluentLogger - fluent-logger-mbed sample |
YuuichiAkagawa | 0:5edb05436aa5 | 2 | * Copyright (c) 2014 Yuuichi Akagawa |
YuuichiAkagawa | 0:5edb05436aa5 | 3 | * |
YuuichiAkagawa | 0:5edb05436aa5 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
YuuichiAkagawa | 0:5edb05436aa5 | 5 | * you may not use this file except in compliance with the License. |
YuuichiAkagawa | 0:5edb05436aa5 | 6 | * You may obtain a copy of the License at |
YuuichiAkagawa | 0:5edb05436aa5 | 7 | * |
YuuichiAkagawa | 0:5edb05436aa5 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
YuuichiAkagawa | 0:5edb05436aa5 | 9 | * |
YuuichiAkagawa | 0:5edb05436aa5 | 10 | * Unless required by applicable law or agreed to in writing, software |
YuuichiAkagawa | 0:5edb05436aa5 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
YuuichiAkagawa | 0:5edb05436aa5 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
YuuichiAkagawa | 0:5edb05436aa5 | 13 | * See the License for the specific language governing permissions and |
YuuichiAkagawa | 0:5edb05436aa5 | 14 | * limitations under the License. |
YuuichiAkagawa | 0:5edb05436aa5 | 15 | */ |
YuuichiAkagawa | 0:5edb05436aa5 | 16 | |
YuuichiAkagawa | 0:5edb05436aa5 | 17 | #include "mbed.h" |
YuuichiAkagawa | 0:5edb05436aa5 | 18 | #include "EthernetInterface.h" |
YuuichiAkagawa | 0:5edb05436aa5 | 19 | #include "FluentLogger.h" |
YuuichiAkagawa | 0:5edb05436aa5 | 20 | |
YuuichiAkagawa | 0:5edb05436aa5 | 21 | EthernetInterface eth; |
YuuichiAkagawa | 0:5edb05436aa5 | 22 | FluentLogger logger("192.168.0.1"); // please set your Fluentd server |
YuuichiAkagawa | 0:5edb05436aa5 | 23 | |
YuuichiAkagawa | 0:5edb05436aa5 | 24 | int main() |
YuuichiAkagawa | 0:5edb05436aa5 | 25 | { |
YuuichiAkagawa | 0:5edb05436aa5 | 26 | uMP mp(64); //Message body |
YuuichiAkagawa | 0:5edb05436aa5 | 27 | eth.init(); //Use DHCP |
YuuichiAkagawa | 0:5edb05436aa5 | 28 | eth.connect(); |
YuuichiAkagawa | 0:5edb05436aa5 | 29 | while(1) { |
YuuichiAkagawa | 0:5edb05436aa5 | 30 | logger.log("debug.test", "Hello mbed"); //message body is simple string |
YuuichiAkagawa | 0:5edb05436aa5 | 31 | wait_ms(5000); |
YuuichiAkagawa | 0:5edb05436aa5 | 32 | } |
YuuichiAkagawa | 0:5edb05436aa5 | 33 | logger.close(); |
YuuichiAkagawa | 0:5edb05436aa5 | 34 | eth.disconnect(); |
YuuichiAkagawa | 0:5edb05436aa5 | 35 | } |