Exemplo n.º 1
0
 public virtual void SetMembers(MacroModel macro, INode node)
 {
     if (macro == null)
     {
         throw new ArgumentNullException("macro");
     }
     if (node == null)
     {
         throw new ArgumentNullException("node");
     }
     _macro = macro;
     ParameterDictionary = new UmbracoParameterDictionary(macro.Properties);
     CultureDictionary   = new UmbracoCultureDictionary();
     _node = node;
 }
Exemplo n.º 2
0
        // ******************************************************************
        // *																*
        // *			           ILogMonitor Interface		            *
        // *																*
        // ******************************************************************

        /// <summary>
        /// Initializes this monitor instance
        /// </summary>
        /// <param name="logManager">
        /// A ILogManager instance that owns this new monitor instance
        /// </param>
        /// <param name="parameters">
        /// An IParameterDictionary instance that holds user defined parameters in the
        /// configuration file
        /// </param>
        public override void Init(
            ILogManager logManager,
            IParameterDictionary parameters)
        {
            // Call base implementation first
            base.Init(logManager, parameters);

            // Set members to default
            Enabled  = Parameters.GetBool(PARAMETER_ENABLED, DEFAULT_ENABLED);
            Interval = Parameters.GetDouble(PARAMETER_INTERVAL, DEFAULT_INTERVAL);
            Level    = Parameters.GetEnum <LogLevel>(PARAMETER_LEVEL, DEFAULT_LEVEL);

            // Create new timer
            m_timer           = new System.Timers.Timer();
            m_timer.Elapsed  += OnTimerElapsedInternal;
            m_timer.AutoReset = true;
            m_timer.Interval  = Interval;
        }
Exemplo n.º 3
0
        // ******************************************************************
        // *																*
        // *					        Constructors                        *
        // *																*
        // ******************************************************************

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="sessionGuid">
        /// A Guid that uniquely indentifies the current logging session
        /// </param>
        /// <param name="sessionFolderFullName">
        /// A string that holds the current session folder (i.e. location where
        /// current log(s) will be persisted) including process context name
        /// </param>
        /// <param name="sessionResourceFolderFullName">
        /// A string that specifies the current session resource folder (i.e. location
        /// inside session folder where resource files will be persisted)
        /// </param>
        /// <param name="config">
        /// An ILogConfig reference to the configuration when the session was started
        /// </param>
        /// <param name="parameters">
        /// A Dictionary that holds parameters that were specified in the
        /// application configuration and associated with this streamer
        /// </param>
        /// <param name="logName">
        /// A string that specifies the log that is associated with this streamer
        /// </param>
        /// <param name="concurrentStreamersSameTypeCount">
        /// An integer that holds the number of streamer instances for this log that are of same
        /// class type. If this value equals <i>1</i>, there is only 1 streamer instance of this
        /// class type associated with the specified log.
        /// </param>
        /// <param name="concurrentStreamersSameTypeIndex">
        /// An integer that holds the specific index number of the streamer instance for this
        /// log for a specific class type. This property will only hold a value larger than zero
        /// when multiple streamers of same class type are associated to same log.
        /// </param>
        public LogStreamerInitArgs(
            Guid sessionGuid,
            string sessionFolderFullName,
            string sessionResourceFolderFullName,
            ILogConfig config,
            IParameterDictionary parameters,
            string logName,
            int concurrentStreamersSameTypeCount,
            int concurrentStreamersSameTypeIndex)
        {
            // Store agruments into members
            SessionGuid                   = sessionGuid;
            SessionFolderFullName         = sessionFolderFullName;
            SessionResourceFolderFullName = sessionResourceFolderFullName;
            SessionConfig                 = config;
            Parameters = parameters;
            LogName    = logName;
            ConcurrentStreamersSameTypeCount = concurrentStreamersSameTypeCount;
            ConcurrentStreamersSameTypeIndex = concurrentStreamersSameTypeIndex;
        }
Exemplo n.º 4
0
        // ******************************************************************
        // *																*
        // *			           ILogMonitor Interface		            *
        // *																*
        // ******************************************************************

        /// <summary>
        /// Initializes this monitor instance
        /// </summary>
        /// <param name="logManager">
        /// A ILogManager instance that owns this new monitor instance
        /// </param>
        /// <param name="parameters">
        /// An IParameterDictionary instance that holds user defined parameters in the
        /// configuration file
        /// </param>
        public override void Init(ILogManager logManager, IParameterDictionary parameters)
        {
            // Call base implementation
            base.Init(logManager, parameters);

            // Set members to default
            m_process = Process.GetCurrentProcess();

            // Resolve user definable parameters
            OnResolveParameters(out m_memory);

            // Check if a valid memory parameter could be resolved
            long memSize;

            if (!TryGetMemorySizeInMB(m_memory, m_process, out memSize))
            {
                throw new ArgumentException(string.Format(
                                                "Invalid 'memory' value; parameter '{0}' is not supported",
                                                m_memory));
            }
        }
Exemplo n.º 5
0
        // ******************************************************************
        // *																*
        // *					  ILogFormatter Interface				    *
        // *																*
        // ******************************************************************

        /// <summary>
        /// Initializes the formatter
        /// </summary>
        /// <param name="parameters">
        /// A IParameterDictionary instance that holds custom parameters that are
        /// defined in the configuration
        /// </param>
        public virtual void Init(IParameterDictionary parameters)
        {
            // Store parameters argument
            Parameters = parameters;
        }
Exemplo n.º 6
0
        // ******************************************************************
        // *																*
        // *			           ILogMonitor Interface		            *
        // *																*
        // ******************************************************************

        /// <summary>
        /// Initializes this monitor instance
        /// </summary>
        /// <param name="logManager">
        /// A ILogManager instance that owns this new monitor instance
        /// </param>
        /// <param name="parameters">
        /// An IParameterDictionary instance that holds user defined parameters in the
        /// configuration file
        /// </param>
        public virtual void Init(ILogManager logManager, IParameterDictionary parameters)
        {
            // Store arguments into properties
            LogManager = logManager;
            Parameters = parameters;
        }