All methods to write and get logs from a json file
Before using the write and get methods, you need to configure a json file
import { LogProvider } from 'pegasus-js' const instance = new LogProvider({ filePath: 'path/to/your/file.json' })
After configuring a json file, now you can use the write method
import { LogProvider } from 'pegasus-js' const instance = new LogProvider({ filePath: 'path/to/your/file.json' }) instance.write({ logs: [ { "logKey": "your awesome log key", "logValue": "your awesome log value" }, { "logKey": "example-1", "logValue": "i like bears" } ] })
After writing some logs, you can now get all of them using this method
import { LogProvider } from 'pegasus-js' const instance = new LogProvider({ filePath: 'path/to/your/file.json' }) instance.getAllLogs(instance.file) // it will return all your logs
Last updated 2 years ago