Esempio n. 1
0
        /** 对象组转字符串 */
        public static string objectsToString(object[] objs)
        {
            if (objs.Length == 0)
            {
                return("");
            }

            if (objs.Length == 1)
            {
                if (objs[0] == null)
                {
                    return("null");
                }
                else
                {
                    return(objs[0].ToString());
                }
            }

            StringBuilder sb = StringBuilderPool.createForThread();

            writeObjectsToStringBuilder(sb, objs);

            return(StringBuilderPool.releaseStrForThread(sb));
        }
Esempio n. 2
0
        private static String exceptionToString(string str, Exception e)
        {
            StringBuilder sb = StringBuilderPool.createForThread();

            writeExceptionToString(sb, str, e);

            return(StringBuilderPool.releaseStrForThread(sb));
        }
Esempio n. 3
0
        public static void toThrowError(StringBuilder sb, Exception e)
        {
            if (sb.Length > 0)
            {
                sb.Append("\n");
            }

            if (e != null)
            {
                sb.Append(e.Message);
                sb.Append("\n");
            }
            else
            {
                e = new Exception(sb.ToString());
            }

            string es = null;

            if (ShineSetting.needError)
            {
                es = sb.ToString();
            }

            sb.Append(stackTraceToString(e));
            sb.Append("\n");

            string str = StringBuilderPool.releaseStrForThread(sb);

            toLog(str, SLogType.Error);

            if (ShineSetting.needError)
            {
                throw new Exception(es);
            }
        }