/// <summary>
        /// Initializes a new instance of the InformationRecord class.
        /// </summary>
        /// <param name="messageData">The object to be transmitted to the host.</param>
        /// <param name="source">The source of the message (i.e.: script path, function name, etc.).</param>
        public InformationRecord(object messageData, string source)
        {
            this.MessageData = messageData;
            this.Source      = source;

            this.TimeGenerated   = DateTime.Now;
            this.NativeThreadId  = PsUtils.GetNativeThreadId();
            this.ManagedThreadId = (uint)Environment.CurrentManagedThreadId;
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// Initializes a new instance of the InformationRecord class.
        ///
        /// </summary>
        /// <param name="messageData">The object to be transmitted to the host.</param>
        /// <param name="source">The source of the message (i.e.: script path, function name, etc.)</param>
        public InformationRecord(Object messageData, string source)
        {
            this.MessageData = messageData;
            this.Source      = source;

            this.TimeGenerated   = DateTime.Now;
            this.NativeThreadId  = PsUtils.GetNativeThreadId();
            this.ManagedThreadId = (uint)System.Threading.Thread.CurrentThread.ManagedThreadId;
        }
        /// <summary>
        ///
        /// Initializes a new instance of the InformationRecord class.
        ///
        /// </summary>
        /// <param name="messageData">The object to be transmitted to the host.</param>
        /// <param name="source">The source of the message (i.e.: script path, function name, etc.)</param>
        public InformationRecord(Object messageData, string source)
        {
            this.MessageData = messageData;
            this.Source      = source;

            this.TimeGenerated = DateTime.Now;
            this.Tags          = new List <string>();
            // domain\user on Windows, just user on Unix
#if UNIX
            this.User = Platform.Unix.UserName;
#else
            this.User = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
#endif
            this.Computer        = PsUtils.GetHostName();
            this.ProcessId       = (uint)System.Diagnostics.Process.GetCurrentProcess().Id;
            this.NativeThreadId  = PsUtils.GetNativeThreadId();
            this.ManagedThreadId = (uint)System.Threading.Thread.CurrentThread.ManagedThreadId;
        }