Пример #1
0
        private static DebugTextDisplayLine CreateLine(SAMLogEntry e)
        {
            DebugTextDisplayLine line;

            switch (e.Level)
            {
            case SAMLogLevel.FATAL_ERROR:
                line = new DebugTextDisplayLine(() => $"[{e.Type}] {e.MessageShort}");
                line.SetBackground(Color.Red);
                line.SetColor(Color.Black);
                return(line);

            case SAMLogLevel.ERROR:
                line = new DebugTextDisplayLine(() => $"[{e.Type}] {e.MessageShort}");
                line.SetBackground(Color.Red * 0.6f);
                line.SetColor(Color.Black);
                return(line);

            case SAMLogLevel.WARNING:
                line = new DebugTextDisplayLine(() => $"[{e.Type}] {e.MessageShort}");
                line.SetBackground(Color.DarkOrange * 0.6f);
                line.SetColor(Color.Black);
                line.SetLifetime(60);
                return(line);

            case SAMLogLevel.INFORMATION:
                line = new DebugTextDisplayLine(() => $"[{e.Type}] {e.MessageShort}");
                line.SetBackground(Color.DodgerBlue * 0.5f);
                line.SetColor(Color.Black);
                line.SetLifetime(30);
                return(line);

            case SAMLogLevel.DEBUG:
                line = new DebugTextDisplayLine(() => $"[{e.Type}] {e.MessageShort}");
                line.SetBackground(Color.GreenYellow * 0.5f);
                line.SetColor(Color.Black);
                line.SetLifetime(5);
                line.SetSpawntime(0.5f);
                line.SetDecaytime(2);
                return(line);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Пример #2
0
        public void Update()
        {
            foreach (var entry in SAMLog.Entries.Reverse().TakeWhile(p => p != _lastReadEntry).Reverse())
            {
                _lines.Add(CreateLine(entry));
                _lastReadEntry = entry;
                DebugSettings.SetManual("DebugTextDisplay", true);
            }

            while (_lines.Count(l => l.IsAlive) > MAX_LINE_COUNT)
            {
                var d = _lines.Where(l => l.IsAlive && l.Lifetime < 60).OrderBy(l => l.Lifetime).FirstOrDefault();
                if (d == null)
                {
                    break;
                }
                d.IsAlive = false;
            }
        }
Пример #3
0
        public async Task LogClient(UserSettings profile, SAMLogEntry entry)
        {
            try
            {
                var ps = new RestParameterSet();
                //ps.AddParameterInt("userid", profile.OnlineUserID, false);
                //ps.AddParameterHash("password", profile.OnlinePasswordHash, false);
                ps.AddParameterString("app_version", SGConstants.Version.ToString(), false);
                ps.AddParameterString("screen_resolution", bridge.DeviceResolution.FormatAsResolution(), false);
                ps.AddParameterString("exception_id", entry.Type, false);
                ps.AddParameterCompressed("exception_message", entry.MessageShort, false);
                ps.AddParameterCompressed("exception_stacktrace", entry.MessageLong, false);
                ps.AddParameterCompressed("additional_info", bridge.FullDeviceInfoString, false);

                var response = await QueryAsync <QueryResultLogClient>("log-client", ps, RETRY_LOGERROR);

                if (response == null)
                {
                    SAMLog.Warning("Log_Upload_LC_NULL", "response == null");
                }
                else if (response.result == "error")
                {
                    SAMLog.Warning("Log_Upload_LC_ERR", response.errormessage);
                }
            }
            catch (RestConnectionException e)
            {
                // well, that sucks
                // probably no internet
                SAMLog.Warning("Backend::LC_RCE", e);                 // probably no internet
            }
            catch (Exception e)
            {
                SAMLog.Error("Backend::LC_E", e);
            }
        }
Пример #4
0
 public async Task LogClient(PlayerProfile profile, SAMLogEntry entry)
 {
     //
 }
Пример #5
0
 public async Task LogClient(UserSettings profile, SAMLogEntry entry)
 {
     //
 }