public void Write(MessageCode code, string extraInformation, MessageLocation location, Exception exception)
        {
            string description;

            if (!Messages.TryGetValue(code, out description))
            {
                throw new ArgumentOutOfRangeException("code");
            }

            var messageCode = string.Format(CultureInfo.InvariantCulture, "XW{0:0000}", (int)code);
            var messageText = string.IsNullOrEmpty(extraInformation)
        ? description
        : string.Format("{0}: {1}", description, extraInformation);

            var message = new ProcessorMessage {
                MessageCode = messageCode,
                MessageText = messageText,
                Location    = location,
                Type        = GetMessageType(code),
                Exception   = exception
            };

            writer.Write(message);
        }
 public void Write(MessageCode code, string extraInformation, MessageLocation location)
 {
     Write(code, extraInformation, location, null);
 }
 public void Write(MessageCode code, MessageLocation location)
 {
     Write(code, null, location, null);
 }