ceils-logger

    0.0.6 • Public • Published

    logger

    Realtime logs in nodejs

    Init

    yarn
    yarn start
    

    Open your browser on http://localhost:3000

    Create log

    Field Type Optional
    timestamp number X
    channel string
    level string
    message string
    context mixed X

    Request

    Method : POST
    Endpoint : http://localhost:3000/log
    Content-type : application/json
    Payload :

    {
      "timestamp": "{{timestamp}}",
      "channel": "{{channel}}",
      "level": "{{level}}",
      "message": "{{message}}",
      "context": {} 
    }

    Curl

    curl --location --request POST 'http://localhost:3000/log' \
    --header 'Content-Type: application/json' \
    --data-raw '{
            "timestamp": "{{timestamp}}",
            "channel": "{{channel}}",
            "level": "{{level}}",
            "message": "{{message}}",
            "context": {{context}}
    }'

    Php

    <?php
    require_once __DIR__.'/vendor/autoload.php';
    use ElephantIO\Client;
    use ElephantIO\Engine\SocketIO\Version2X;
     
    $token = 'token';
     
    $client = new Client(new Version2X('http://localhost:3000'[
        'headers' => [
            'Authorization: Bearer ' . $token,
            'User: username',
        ]
    ]));
     
    $client->initialize();
     
    $client->emit('+message'[
        'channel' => 'php',
        'level'   => 'DEBUG',
        'message' => 'test log php',
        'context' => []
    ]);
     
    $client->close();

    screenshot

    Install

    npm i ceils-logger

    DownloadsWeekly Downloads

    1

    Version

    0.0.6

    License

    none

    Unpacked Size

    260 kB

    Total Files

    13

    Last publish

    Collaborators

    • tciles