https://github.com/austintgriffith/logger
https://github.com/austintgriffith/logger
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/austintgriffith/logger
- Owner: austintgriffith
- Created: 2016-03-18T13:56:02.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-12-02T14:54:03.000Z (over 9 years ago)
- Last Synced: 2025-06-14T03:05:26.439Z (about 1 year ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# logger
POST a JSON object to /:yournamespace

GET /:yournamespace/[:numberoflines] to read logs

Example PHP Code:
```php
$ch = curl_init();curl_setopt($ch, CURLOPT_URL,"logger.madwire.net/###NAMESPACE###");curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2000);curl_setopt($ch, CURLOPT_TIMEOUT, 3000);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,"###somekey###=###somevalue###");$result=curl_exec($ch);curl_close($ch);
```
Example Node Code:
```javascript
function logger(namespace,object){
var http = require("http");
var options = {
hostname: 'logger.madwire.net',
port: 80,
path: '/'+namespace,
method: 'POST',
headers: {
'Content-Type': 'application/json',
}
};
var req = http.request(options, function(res) {
//console.log('Status: ' + res.statusCode);
//console.log('Headers: ' + JSON.stringify(res.headers));
res.setEncoding('utf8');
res.on('data', function (body) {
//console.log('Body: ' + body);
});
});
req.on('error', function(e) {
console.log('problem with request: ' + e.message);
});
// write data to request body
req.write(JSON.stringify(object));
req.end();
}
```