talker icon indicating copy to clipboard operation
talker copied to clipboard

History file initialization

Open tas-unn opened this issue 4 months ago • 4 comments

I wanted to make it so that after restarting the application the talker would save the history in my application. In theory, to do this you need to save the history to a file, and then pick up this file during initialization

--

Хотел сделать в своём приложении так, чтобы после перезапуска приложения талкер сохранял историю. По идее для этого нужно сохранять историю в файл, а потом при инициализации подцеплять этот файл

tas-unn avatar Feb 19 '24 07:02 tas-unn

Hi @tas-unn!

Yes, you can currently save the log history to a file and read it on restart. However, you will need to create an adapter to save data in database format and read it.

To inject the required logs when starting the project, use the history field in the constructor or the config method:

--

Привет tas-unn ! Да, ты можешь прямо сейчас сохранить историю логов в файл и прочитать её при перезаходе. Но тогда понадобится сделать адаптер для сохранения данных в формат базы данных и чтение.

Чтобы при запуске проекта подставить нужные тебе логи - воспользуйся полем history в конструкторе или методе config

TalkerHistory? history,

Frezyx avatar Mar 19 '24 19:03 Frezyx

я создал класс class MyTalkerHistory extends TalkerHistory и имплементировал 3 метода (clean, write, read). Если я хочу записать файл, там объект ТалкерДата. Как мне его запихнуть в файл (например FllutterSecurityStorage или Shared_Preferences) и затем прочитать? все методы синхронные, а запись и чтение обычно асинхронные. Плюс конвертация TalkerData как должна происходить?

I created a class class MyTalkerHistory extends TalkerHistory and implemented 3 methods (clean, write, read). If I want to write a file, there is a TalkerData object there. How can I put it into a file (for example FlutterSecurityStorage or Shared_Preferences) and then read it? All methods are synchronous, while writing and reading are usually asynchronous. Plus, how should TalkerData be converted?

tas-unn avatar Apr 01 '24 07:04 tas-unn

@tas-unn you would have to convert the talker data into some format you want (maybe json) and write that as a string to a file or database.

It is however impossible to convert back to TalkerData if you want to read from that file as well. But I created a separate Feature Request for that. #218

XanderD99 avatar Apr 10 '24 19:04 XanderD99