private static MessageContext MessageContext(IPassport passport
                                                            , PassportLevel level
                                                            , string messageTemplate
                                                            , object[] messageTemplateParameters
                                                            , string user
                                                            , string memberName
                                                            , string sourceFilePath
                                                            , int sourceLineNumber
                                                            , bool logCaller = false
                                                            , int scopeDepth = -1
                                                            )
        {
            var scope = passport.Scope;

            var messageContext = new MessageContext
            {
                Session = passport.SessionId,
                Passport = passport.PassportId,
                Member = scope != null ? scope.Name ?? string.Empty : string.Empty,
                CallContext = scope != null ? scope.Id.ToString() : string.Empty,
                ParentContext = scope != null ? (scope.Parent != null ? scope.Parent.Id.ToString() : string.Empty) : string.Empty,
                Level = level,
                MessageTemplate = messageTemplate,
                MessageTemplateParameters = messageTemplateParameters,
                User = user,
                MemberName = memberName,
                SourceFilePath = sourceFilePath,
                SourceLineNumber = sourceLineNumber,
                LogCaller = logCaller,
                ScopeDepth = scopeDepth
            };

            Console.WriteLine("{0} {1}"
                                    , messageContext.Timestamp.ToString("HH:mm:ss.FFFFFFF")
                                    , messageContext.Id
                                    //, messageContext.Session
                                    //, messageContext.Passport
                                    //, messageContext.MessageTemplate
                                    );
            return messageContext;
        }
Exemplo n.º 2
0
        private static MessageContext MessageContext(IPassport passport
                                                     , PassportLevel level
                                                     , string messageTemplate
                                                     , object[] messageTemplateParameters
                                                     , string user
                                                     , string memberName
                                                     , string sourceFilePath
                                                     , int sourceLineNumber
                                                     , bool logCaller = false
                                                     , int scopeDepth = -1
                                                     )
        {
            var scope = passport.Scope;

            var messageContext = new MessageContext
            {
                Session     = passport.SessionId,
                Passport    = passport.PassportId,
                Member      = scope != null ? scope.Name ?? string.Empty : string.Empty,
                CallContext = scope != null?scope.Id.ToString() : string.Empty,
                                  ParentContext             = scope != null ? (scope.Parent != null ? scope.Parent.Id.ToString() : string.Empty) : string.Empty,
                                  Level                     = level,
                                  MessageTemplate           = messageTemplate,
                                  MessageTemplateParameters = messageTemplateParameters,
                                  User             = user,
                                  MemberName       = memberName,
                                  SourceFilePath   = sourceFilePath,
                                  SourceLineNumber = sourceLineNumber,
                                  LogCaller        = logCaller,
                                  ScopeDepth       = scopeDepth
            };

            Console.WriteLine("{0} {1}"
                              , messageContext.Timestamp.ToString("HH:mm:ss.FFFFFFF")
                              , messageContext.Id
                              //, messageContext.Session
                              //, messageContext.Passport
                              //, messageContext.MessageTemplate
                              );
            return(messageContext);
        }