Beispiel #1
0
        public static int WriteEvent(string level, string group, ApplicationType applicationType, string applicationName, string loggingUserType, string logginUserId, string affectedUserType, string affectedUserId, string type, string details, string clientip, string hostip)
        {
            int?   eventid    = null;
            string resultcode = null;

            if (clientip == null)
            {
                clientip = ClientTools.IPAddress();
            }
            if (hostip == null)
            {
                hostip = ServerTools.IPv4Addresses.First().ToString();
            }

            XElement xDetails = XElement.Parse(string.Format("<details>{0}</details>", details));

            using (LumberjackLinqDataContext db = new LumberjackLinqDataContext(ConfigurationManager.ConnectionStrings["LumberjackConnectionString"].ToString())) {
                db.xspWriteDirectEvent(
                    applicationType.ToString(),
                    applicationName,
                    1,
                    loggingUserType,
                    logginUserId,
                    affectedUserType,
                    affectedUserId,
                    group,
                    level,
                    type,
                    xDetails,
                    clientip,
                    hostip,
                    ref eventid,
                    ref resultcode
                    );
            }

            return((int)eventid);
        }
Beispiel #2
0
        private static void WriteAsyncEvent(object oParameters)
        {
            EventParams parameters = (EventParams)oParameters;

            int?   eventid    = null;
            string resultcode = null;

            if (parameters.Clientip == null)
            {
                parameters.Clientip = ClientTools.IPAddress();
            }
            if (parameters.Hostip == null)
            {
                parameters.Hostip = ServerTools.IPv4Addresses.First().ToString();
            }

            XElement xDetails = XElement.Parse(string.Format("<details>{0}</details>", parameters.Details));

            using (LumberjackLinqDataContext db = new LumberjackLinqDataContext(ConfigurationManager.ConnectionStrings["LumberjackConnectionString"].ToString())) {
                db.xspWriteDirectEvent(
                    parameters.ApplicationType.ToString(),
                    parameters.ApplicationName,
                    1,
                    parameters.LoggingUserType,
                    parameters.LogginUserId,
                    parameters.AffectedUserType,
                    parameters.AffectedUserId,
                    parameters.Group,
                    parameters.Level,
                    parameters.Type,
                    xDetails,
                    parameters.Clientip,
                    parameters.Hostip,
                    ref eventid,
                    ref resultcode
                    );
            }
        }