0
I have this code below, would be able to generate Log by date of day? Example: log_29072020.txt
private void Log(string mensagem)
{
string ficheiro = Environment
.GetFolderPath(Environment.SpecialFolder.MyComputer)
+ @"\Debug\Log.txt";
if (!Directory.Exists(Path.GetDirectoryName(ficheiro)))
Directory.CreateDirectory(Path.GetDirectoryName(ficheiro));
StreamWriter file = new StreamWriter(ficheiro, true, Encoding.Default);
file.WriteLine(DateTime.Now + " > " + mensagem);
file.Dispose();
}
And create an action of what was made of the system, I just got the message.
Thank you Virgilio Novic
– Evanilson Silva
if this is the expected response, please tick @Evanilsonsilva
– novic
in that same code would have to restrict the amount of log created, example: when it arrived in an amount of 30 logs, in the next log it would delete or overwrite the first log, thus always staying the amount of 30 logs, would have to do ?
– Evanilson Silva
@Evanilsonsilva yes, programming is unlimited, only that there is already another doubt, every doubt generates a question here in pt.stackoverflow for better organization ... so create another question
– novic
Yeah, thanks again @Virgilio Novic
– Evanilson Silva