1, Android reasonable management log logs, in the development of the time to print out, at the time of release, all the log log off the method as follows: In order to facilitate the operation of the log need to customize a logger class and then develop all the log printing use this class. Below is the source code of logger class.
/*** Development of Log Management: * In the development of the log is often printed, but when we publish the project is not printing, if the printing will be a security problem or inefficient execution. * In order to facilitate the operation of log need to customize a log class and then in the development of the definition of the log class, * and then in the development phase of the following Log_level set to 6, so that all the log can be displayed, * at the time of release we set Log_level to 0, so that log does not display, Very convenient to manage the * **/ Public classLogger { Public Static intLog_level = 6; Public Static intERROR = 1; Public Static intWARN = 2; Public Static intINFO = 3; Public Static intDEBUG = 4; Public Static intVERBOSE = 5; Public Static voide (string tag, string msg) {if(Log_level >ERROR) {LOG.E (tag, msg); } } Public Static voidW (string tag, string msg) {if(Log_level >WARN) {LOG.W (tag, msg); } } Public Static voidI (string tag, string msg) {if(Log_level >INFO) {LOG.I (tag, msg); } } Public Static voidd (string tag, string msg) {if(Log_level >DEBUG) {LOG.D (tag, msg); } } Public Static voidV (string tag, string msg) {if(Log_level >VERBOSE) {LOG.V (tag, msg); } }}
(34) Log management in development (how to remove all log logs when the application is published)