Search code examples
node.jsloggingormdgraph

How to get ' logs' of the queries in dgraph-orm


The earlier version of dgraph-orm provided logging of the queries by default but after the latest update it has been turned off. So is there any way to turn on the logging. I need to debug and find out if the queries being fired are correct.

This is what I have tried:

    dgraph.connect(config.database.dgraph);
    dgraph.logging((a)=>console.log(a));

The version that I am using is 1.2.2.


Solution

  • I have checked any its working fine, find the snippet below

    import dgraph from 'dgraph-orm';
    
    // you can pass your logger function here
    dgraph.logging(console.log);