Exemplo n.º 1
0
        internal static IReadOnlyDictionary <LogDomain, LogLevel> GetLogLevels(LogDomain domains)
        {
            var retVal = new Dictionary <LogDomain, LogLevel>();

            if (domains.HasFlag(LogDomain.Couchbase))
            {
                retVal[LogDomain.Couchbase] = Log.To.Couchbase.Level;
            }

            if (domains.HasFlag(LogDomain.Database))
            {
                retVal[LogDomain.Database] = Log.To.Database.Level;
            }

            if (domains.HasFlag(LogDomain.Query))
            {
                retVal[LogDomain.Query] = Log.To.Query.Level;
            }

            if (domains.HasFlag(LogDomain.Replicator))
            {
                retVal[LogDomain.Replicator] = Log.To.Sync.Level;
            }

            if (domains.HasFlag(LogDomain.Network))
            {
                retVal[LogDomain.Network] = (LogLevel)Native.c4log_getLevel(Log.LogDomainBLIP);
            }

            return(retVal);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets the log level for the given domains(s)
        /// </summary>
        /// <param name="domains">The domains(s) to change the log level for</param>
        /// <param name="level">The level to set the logging to</param>
        public static void SetLogLevel(LogDomain domains, LogLevel level)
        {
            if (domains.HasFlag(LogDomain.Couchbase))
            {
                Log.To.Couchbase.Level = level;
                Log.To.LiteCore.Level  = level;
            }

            if (domains.HasFlag(LogDomain.Database))
            {
                Log.To.Database.Level = level;
            }

            if (domains.HasFlag(LogDomain.Query))
            {
                Log.To.Query.Level = level;
            }

            if (domains.HasFlag(LogDomain.Replicator))
            {
                Log.To.Sync.Level = level;
            }

            if (domains.HasFlag(LogDomain.Network))
            {
                Native.c4log_setLevel(Log.LogDomainBLIP, (C4LogLevel)level);
                Native.c4log_setLevel(Log.LogDomainWebSocket, (C4LogLevel)level);
            }
        }