Answer the question
In order to leave comments, you need to log in
What do you think about my logging implementation?
Hello. I made a flexible logging system. I can add new types of logs to the config and delete them
"Types" : [
"Debug",
"Info",
"Warn",
"Error",
"Fatal"
]
"EmailSend" : [
"Error",
"Fatal"
]
('time log','type log','message log'),('time log','type log','message log'),('time log','type log','message log')
DB.Exec("INSERT INTO " + MysqlTable + " (type,time,messages) VALUES" + strings.TrimRight(data, ","))
Answer the question
In order to leave comments, you need to log in
1. Replace strings with constants, preferably numeric. It will be less likely to make a mistake, because the constants are checked during compilation, plus it will work faster (in the case of numeric constants).
2. It's worth trying RabbitMq to manage the db write queue instead of cycling. Or you can try specialized databases that are created specifically for storing logs.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question