mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Add ChatBot logging to file and 'log' command
- log <text> will print '[BOT] text' to the console - logged [BOT] lines can be written to a logfile - chatbotlogfile INI setting is used to set the log file
This commit is contained in:
parent
6f1fcb22ce
commit
162a1414bf
5 changed files with 63 additions and 15 deletions
|
|
@ -90,20 +90,7 @@ namespace MinecraftClient.ChatBots
|
|||
private void save(string tosave)
|
||||
{
|
||||
if (dateandtime)
|
||||
{
|
||||
int day = DateTime.Now.Day, month = DateTime.Now.Month;
|
||||
int hour = DateTime.Now.Hour, minute = DateTime.Now.Minute, second = DateTime.Now.Second;
|
||||
|
||||
string D = day < 10 ? "0" + day : "" + day;
|
||||
string M = month < 10 ? "0" + month : "" + day;
|
||||
string Y = "" + DateTime.Now.Year;
|
||||
|
||||
string h = hour < 10 ? "0" + hour : "" + hour;
|
||||
string m = minute < 10 ? "0" + minute : "" + minute;
|
||||
string s = second < 10 ? "0" + second : "" + second;
|
||||
|
||||
tosave = "" + D + '-' + M + '-' + Y + ' ' + h + ':' + m + ':' + s + ' ' + tosave;
|
||||
}
|
||||
tosave = getTimestamp() + ' ' + tosave;
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(logfile));
|
||||
FileStream stream = new FileStream(logfile, FileMode.OpenOrCreate);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue