Imported from Bitbucket

heads

tip
browse log

clone

read-only
https://hg.sr.ht/~henryprecheur/restlog
read/write
ssh://hg@hg.sr.ht/~henryprecheur/restlog

#restlog

Add to the log using POST:

for i in 1 2 3 do curl --data "$i log" --header "Content-Type: text/plain" 'localhost:8000/mylog' done

Only text/plain is supported at the moment:

POST /mylog
Content-Type: text/plain

This string shouldn't contain any \n

Return what got written to the log:

curl --data "hello world" --header "Content-Type: text/plain" ... 2013-08-22T15:53:02-07:00 hello world

#Log format

[-+]{RFC3339} {message}\n
  • Addition
  • Deletion

If prefix is '+' add entry to the logs, if prefix is '-' remove the 1st corresponding entry from the logs.

Example (Python):

logs = [
    '+2013-09-03T10:00:00-04:00 test\n',
    '-2013-09-03T10:00:00-04:00 test\n',
    '+2013-09-03T11:00:00-04:00 test\n',
    '-2013-09-03T12:00:00-04:00 test\n',
]