Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Latest commit

 

History

History
90 lines (72 loc) · 2.95 KB

README.md

File metadata and controls

90 lines (72 loc) · 2.95 KB

This is simple REAL-TIME log.

Build Status Scrutinizer Code Quality Coverage Status Maintainability PyPI PRs Welcome

Demo: how to use REAL-TIME log

Just open main page obtain your unique streamId (you will be redirected) or open certain stream (specify streamId in url like: https://realtimelog.herokuapp.com/test) and start listen you real time logs!!!

Under the hood, this log works with WebSockets so you will see logs immediately in your browser!

With the purpose to post something in your log stream use any code from examples below.

JavaScript:

fetch('https://realtimelog.herokuapp.com/test', {
  method: 'post', headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({code: 200, status: 'OK'})
});

NodeJS:

const r = require('https').request({
  host: 'realtimelog.herokuapp.com',
  path: '/test',
  method: 'POST',
  headers: {'Content-Type': 'application/json'}
});
r.write(JSON.stringify({code: 200, status: 'OK'}));
r.end();

Go:

import (
  "bytes"
  "encoding/json"
  "net/http"
)
j, _ := json.Marshal(map[string]string{"code": "200", "status": "OK"})
http.Post("https://realtimelog.herokuapp.com/test", "application/json", bytes.NewBuffer(j))

PHP:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://realtimelog.herokuapp.com/test');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['code' => 200, 'status' => 'OK']));
curl_exec($ch);
// OR
exec("curl -s https://realtimelog.herokuapp.com/test -H 'Content-Type: application/json' -d '".json_encode(['code' => 200])."'");

Python:

import requests
import json
requests.post(
  'https://realtimelog.herokuapp.com/test',
  data=json.dumps({'code': 200, 'status': 'OK'}),
  headers={'Content-Type': 'application/json'},
)

Bash:

curl -XPOST 'https://realtimelog.herokuapp.com/test' \
-H 'Content-Type: application/json' -d '{"code": 200, "status": "OK"}'
// OR
["sh", "-c", "curl -XPOST 'https://realtimelog.herokuapp.com:443/test' -H 'Content-Type: application/json' -d '{\"code\": 200}'"]

Sponsors

JetBrains