public void LogBatch(Log.PriorityFlags logLevel, StructuredLogObject logObject, LogChannelType channel = LogChannelType.Default)
 {
     if (!clubPenguinClient.OfflineMode)
     {
         LogParameters logParameters = new LogParameters();
         logParameters.logName  = channel.ToString();
         logParameters.severity = logLevelsToString[logLevel];
         logParameters.message  = Service.Get <JsonService>().Serialize(logObject);
         logParametersList.Add(logParameters);
     }
 }
 private void log(StructuredLogObject logObject, bool batch = false)
 {
     batchedCount++;
     if (diagService == null)
     {
         queuedLogs.Enqueue(logObject);
         return;
     }
     diagService.LogBatch(Log.PriorityFlags.ERROR, logObject, LogChannelType.Exception);
     if (!batch || batchedCount > 10)
     {
         Flush();
     }
 }
 public void LogImmediate(Log.PriorityFlags logLevel, StructuredLogObject logObject, LogChannelType channel = LogChannelType.Default)
 {
     if (!clubPenguinClient.OfflineMode)
     {
         LogParameters logParameters = new LogParameters();
         logParameters.logName  = channel.ToString();
         logParameters.severity = logLevelsToString[logLevel];
         logParameters.message  = Service.Get <JsonService>().Serialize(logObject);
         logParametersList.Add(logParameters);
         APICall <PostDiagnosticsLogOperation> aPICall = PostDiagnosticsLog(logParametersList);
         aPICall.OnComplete += onPostDiagnosticsLog;
         aPICall.Execute();
     }
 }
Пример #4
0
        public StructuredLogObject CreateBaseStructuredLogObject(string message, LogMessageType type, string stackTrace = null, string playerId = null, string playerName = null)
        {
            StructuredLogObject structuredLogObject = new StructuredLogObject();

            structuredLogObject.Value            = message;
            structuredLogObject.LogMessageType   = type.ToString();
            structuredLogObject.ClientVersion    = ClientInfo.Instance.ClientVersion;
            structuredLogObject.DeviceModel      = SystemInfo.deviceModel;
            structuredLogObject.OperatingSystem  = SystemInfo.operatingSystem;
            structuredLogObject.SystemMemorySize = Convert.ToString(SystemInfo.systemMemorySize);
            if (!string.IsNullOrEmpty(stackTrace))
            {
                structuredLogObject.StackTrace = stackTrace;
            }
            playerName = playerName ?? "<not set>";
            playerId   = playerId ?? "<not set>";
            structuredLogObject.PlayerName = playerName;
            structuredLogObject.PlayerId   = playerId;
            return(structuredLogObject);
        }
Пример #5
0
        public void LogExceptionBatch(Exception ex)
        {
            StructuredLogObject logObject = CreateBaseStructuredLogObject(ex.ToString(), LogMessageType.HandledException);

            LogBatch(Log.PriorityFlags.ERROR, logObject, LogChannelType.Exception);
        }
Пример #6
0
 public void LogBatch(Log.PriorityFlags logLevel, StructuredLogObject logObject, LogChannelType channel = LogChannelType.Default)
 {
     clubPenguinClient.DiagnosticsApi.LogBatch(logLevel, logObject, channel);
 }
    public void LogError(string errorMsg)
    {
        StructuredLogObject logObject = createStructuredLogObject(errorMsg, LogMessageType.Error);

        log(logObject, batch: true);
    }
    public void LogUnhandledException(string message)
    {
        StructuredLogObject logObject = createStructuredLogObject(message, LogMessageType.HandledException);

        log(logObject);
    }
    public void LogUnhandledException(Exception ex)
    {
        StructuredLogObject logObject = createStructuredLogObject(ex.ToString(), LogMessageType.UnhandledException);

        log(logObject);
    }
    public void LogHandledExceptionMessage(string message)
    {
        StructuredLogObject logObject = createStructuredLogObject(message, LogMessageType.HandledException);

        log(logObject, batch: true);
    }
    public void LogHandledException(Exception ex, string stackTrace)
    {
        StructuredLogObject logObject = createStructuredLogObject(ex.ToString(), LogMessageType.HandledException, stackTrace);

        log(logObject, batch: true);
    }