package mdb import ( "context" "kurumibot/database" "kurumibot/laniakea" "time" ) type ConsoleLogEntry struct { Level string `bson:"level"` Prefix string `bson:"prefix"` Traceback string `bson:"traceback"` Message string `bson:"message"` Time time.Time `bson:"time"` TimeStamp int64 `bson:"timeStamp"` } func WriteConsoleLog(db *laniakea.DatabaseContext, e *ConsoleLogEntry) error { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() col := database.GetMongoCollection(db, "logs") _, err := col.InsertOne(ctx, e) return err } type MessageLogEntry struct { MessageID int `bson:"messageId"` SenderID int `bson:"senderId"` ChatID int `bson:"chatId"` Text string `bson:"text"` TimeStamp int64 `bson:"timestamp"` } func WriteMessageLog(db *laniakea.DatabaseContext, e *MessageLogEntry) error { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() col := database.GetMongoCollection(db, "msg_logs") _, err := col.InsertOne(ctx, e) return err }