Set the logging mode#
Depending on how you want the data to be stored and synchronized, you can use Neptune in five different connection modes.
For example, if you're debugging your code, you can use Neptune in such a way that no data is uploaded or stored at all.
Mode | Parameter value | Description |
---|---|---|
Asynchronous (default) | async |
Tracked data is stored locally and synchronized separately in the background. |
Debug | debug |
No data is stored locally or sent to Neptune. |
Offline | offline |
Data is not sent to Neptune, but stored locally. Can later be synced manually. |
Read only | read-only |
Used to only fetch data from existing objects. Ensures that no data is added or changed. |
Synchronous | sync |
Neptune waits for other calls to reach the server before executing a tracking call. |
Setting the connection mode#
You can set the mode through either an environment variable or an initialization parameter.
Environment variable#
The environment variable is used if the mode
parameter is omitted from the init
function.
Tip
This can be a handy way to debug or "switch off" Neptune without modifying your code.
Argument of init()
function#
To set the connection mode for the logging, provide it to the mode
argument of the initialization function:
To only enable querying and no logging of new data, you can initialize an object in read only mode:
Related
- How to use
wait()
andsync()
to ensure synchronous logging - API reference ≫ Connection modes reference
- Help ≫ Debugging options