static void WriteLog(OP_LOG_LEVEL logLevel, ConcurrentBag <DBOperationLog> collectedLogs)
        {
            try
            {
                if (collectedLogs.IsEmpty())
                {
                    return;
                }

                var inertLogs = new List <DBOperationLog>();

                for (int i = 0; i < MAX_LOG_COUNT_AT_IME_WRITE; ++i)
                {
                    DBOperationLog log;
                    if (collectedLogs.TryTake(out log))
                    {
                        inertLogs.Add(log);
                    }
                    else
                    {
                        break;
                    }
                }

                switch (logLevel)
                {
                case OP_LOG_LEVEL.TRACE:
                    GetMongoDBCollection <DBOperationLog>("Trace").InsertManyAsync(inertLogs).Wait();
                    break;

                case OP_LOG_LEVEL.INFO:
                    GetMongoDBCollection <DBOperationLog>("Info").InsertManyAsync(inertLogs).Wait();
                    break;

                case OP_LOG_LEVEL.ERROR:
                    GetMongoDBCollection <DBOperationLog>("Error").InsertManyAsync(inertLogs).Wait();
                    break;

                case OP_LOG_LEVEL.EXCEPTION:
                    GetMongoDBCollection <DBOperationLog>("Exception").InsertManyAsync(inertLogs).Wait();
                    break;
                }
            }
            catch (Exception ex)
            {
                FileLogger.Exception(ex.Message);
            }
        }
        static void AddLog(OP_LOG_LEVEL logLevel, LOG_TYPE logType, Int64 groupId, string message,
                           string callerName, string callerFilePath, int lineNumber)
        {
            if (IsEnable == false)
            {
                return;
            }

            var log = new DBOperationLog()
            {
                STime   = ServerStartTime,
                GroupID = groupId,
                Lv      = (int)logLevel,
                LT      = (int)logType,
                IP      = ServerIP,
                SType   = ServerType,
                Time    = DateTime.Now,
                CF      = callerName,
                FL      = callerFilePath,
                Line    = lineNumber,
                Msg     = message,
            };

            switch (logLevel)
            {
            case OP_LOG_LEVEL.TRACE:
                TraceLogs.Add(log);
                break;

            case OP_LOG_LEVEL.INFO:
                InfoLogs.Add(log);
                break;

            case OP_LOG_LEVEL.ERROR:
                ErrorLogs.Add(log);
                break;

            case OP_LOG_LEVEL.EXCEPTION:
                ExceptionLogs.Add(log);
                break;
            }

            ConsoleWrite(log);
        }