当前位置: 首页>>代码示例>>C#>>正文


C# ILog类代码示例

本文整理汇总了C#中ILog的典型用法代码示例。如果您正苦于以下问题:C# ILog类的具体用法?C# ILog怎么用?C# ILog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ILog类属于命名空间,在下文中一共展示了ILog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EnsureTargetFile

 static void EnsureTargetFile(string pathToLock, ILog log)
 {
     try
     {
         var directoryName = Path.GetDirectoryName(pathToLock);
         if (!Directory.Exists(directoryName))
         {
             log.Info("Directory {0} does not exist - creating it now", pathToLock);
             Directory.CreateDirectory(directoryName);
         }
     }
     catch (IOException)
     {
         //Someone else did this under us
     }
     try
     {
         if (!File.Exists(pathToLock))
         {
             File.WriteAllText(pathToLock, "A");
         }
     }
     catch (IOException)
     {
         //Someone else did this under us
     }
 }
开发者ID:xenoputtss,项目名称:Rebus,代码行数:27,代码来源:FilesystemExclusiveLock.cs

示例2: Inserir

        /// <exception cref="MyException"></exception>
        public void Inserir(ICliente cliente, ILog log)
        {
            var sql = new StringBuilder();
            var tblLog = new TblClientesLog();

            sql.AppendFormat(" INSERT INTO {0} ({1},{2},{3}", tblLog.NomeTabela, tblLog.Clientes_Id, tblLog.Clientes_Nome, tblLog.Clientes_Status_Id);
            sql.AppendFormat(",{0},{1},{2})", tblLog.Usuarios_Id, tblLog.Operacao_Id, tblLog.DataHora);
            sql.Append(" VALUES (@id,@nome,@status_id");
            sql.Append(",@usuarios_id,@operacao_id,@datahora);");

            using (var dal = new DalHelperSqlServer())
            {
                try
                {
                    dal.CriarParametroDeEntrada("id", SqlDbType.Int, cliente.Id);
                    dal.CriarParametroDeEntrada("nome", SqlDbType.Char, cliente.Nome);
                    dal.CriarParametroDeEntrada("status_id", SqlDbType.SmallInt, cliente.Status.GetHashCode());
                    dal.CriarParametroDeEntrada("usuarios_id", SqlDbType.Int, log.Usuario.Id);
                    dal.CriarParametroDeEntrada("operacao_id", SqlDbType.SmallInt, log.Operacao.GetHashCode());
                    dal.CriarParametroDeEntrada("datahora", SqlDbType.DateTime, log.DataHora);

                    dal.ExecuteNonQuery(sql.ToString());
                }
                catch (SqlException) { throw new MyException("Operação não realizada, por favor, tente novamente!"); }
            }
        }
开发者ID:phcbarros,项目名称:Estudos,代码行数:27,代码来源:DaoClienteLog.cs

示例3: CallMmCodeDataProvider

 public CallMmCodeDataProvider(IAmDataProvider dataProvider, IReadOnlyRepository repository, ILogCommandTypes logCommand)
 {
     _log = LogManager.GetLogger(GetType());
     _dataProvider = dataProvider;
     _repository = repository;
     _logCommand = logCommand;
 }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:7,代码来源:CallMMCodeDataProvider.cs

示例4: ArchivingEngine

 public ArchivingEngine(
     string sourceRootFolder,
     string targetRootFolder,
     ArchivingSettings settings,
     TotalStatistics statistics,
     ILog log)
 {
     this.sourceRootFolder = sourceRootFolder;
     this.targetRootFolder = targetRootFolder;
     this.statistics = statistics;
     this.settings = settings;
     this.log = log;
     queue = new RingBuffer<Processing>();
     processingDistributor = new ProcessingDistributor(
         sourceRootFolder,
         targetRootFolder,
         statistics,
         queue,
         log);
     processingPool = new PipelinesPool(processingDistributor);
     retrievingDistributor = new RetrievingDistributor(
         queue,
         log);
     retrievingPool = new PipelinesPool(retrievingDistributor);
 }
开发者ID:vbogretsov,项目名称:threading,代码行数:25,代码来源:ArchivingEngine.cs

示例5: ApplicationContext

 public ApplicationContext(string projectRoot, ProjectConfig projectConfig, UserConfig userConfig, ILog log)
 {
     mProjectRoot = projectRoot;
     mProjectConfig = projectConfig;
     mUserConfig = userConfig;
     mLog = log;
 }
开发者ID:aiedail92,项目名称:DBBranchManager,代码行数:7,代码来源:ApplicationContext.cs

示例6: EventStoreEventPersistence

 public EventStoreEventPersistence(
     ILog log,
     IEventStoreConnection connection)
 {
     _log = log;
     _connection = connection;
 }
开发者ID:joaomajesus,项目名称:EventFlow,代码行数:7,代码来源:EventStoreEventPersistence.cs

示例7: ExecuteReplCommand

        public ExecuteReplCommand(
            string scriptName,
            string[] scriptArgs,
            IFileSystem fileSystem,
            IScriptPackResolver scriptPackResolver,
            IRepl repl,
            ILogProvider logProvider,
            IConsole console,
            IAssemblyResolver assemblyResolver,
            IFileSystemMigrator fileSystemMigrator,
            IScriptLibraryComposer composer)
        {
            Guard.AgainstNullArgument("fileSystem", fileSystem);
            Guard.AgainstNullArgument("scriptPackResolver", scriptPackResolver);
            Guard.AgainstNullArgument("repl", repl);
            Guard.AgainstNullArgument("logProvider", logProvider);
            Guard.AgainstNullArgument("console", console);
            Guard.AgainstNullArgument("assemblyResolver", assemblyResolver);
            Guard.AgainstNullArgument("fileSystemMigrator", fileSystemMigrator);
            Guard.AgainstNullArgument("composer", composer);

            _scriptName = scriptName;
            _scriptArgs = scriptArgs;
            _fileSystem = fileSystem;
            _scriptPackResolver = scriptPackResolver;
            _repl = repl;
            _logger = logProvider.ForCurrentType();
            _console = console;
            _assemblyResolver = assemblyResolver;
            _fileSystemMigrator = fileSystemMigrator;
            _composer = composer;
        }
开发者ID:JamesLinus,项目名称:scriptcs,代码行数:32,代码来源:ExecuteReplCommand.cs

示例8: SmtpClientSession

        public SmtpClientSession(ILog log, SmtpClientSessionConfiguration configuration, MessageData messageData)
        {
            _log = log;
            _configuration = configuration;

            _messageData = messageData;
        }
开发者ID:hmailserver,项目名称:hmailserver-net,代码行数:7,代码来源:SmtpClientSession.cs

示例9: TaskActions

		public TaskActions(RavenFileSystem fileSystem, ILog log)
			: base(fileSystem, log)
		{
			timer = Observable.Interval(TimeSpan.FromMinutes(1));

			InitializeTimer();
		}
开发者ID:GorelH,项目名称:ravendb,代码行数:7,代码来源:TaskActions.cs

示例10: DoLogDirectoryContent

        public static void DoLogDirectoryContent(ILog logger, string directory)
        {
            if (logger == null)
                throw new ArgumentNullException("logger");

            bool exists = Directory.Exists(directory);

            logger.Info("-- Logging directory content:");
            logger.Info("Directory: '" + directory + "'");
            logger.Info("Directory exists: " + exists);

            if (exists)
            {
                string[] files = Directory.GetFiles(directory);
                foreach (string file in files)
                {
                    FileInfo fileInfo = new FileInfo(file);
                    logger.Info("File: '" + file + "' (size=" + fileInfo.Length + ")");
                }

                string[] directories = Directory.GetDirectories(directory);
                foreach (string subDirectory in directories)
                {
                    logger.Info("Directory: '" + subDirectory + "'");
                }
            }

            logger.Info("--");
        }
开发者ID:ViniciusConsultor,项目名称:hudson-tray-tracker,代码行数:29,代码来源:LoggingHelper.cs

示例11: CommonScriptEngine

 protected CommonScriptEngine(IScriptHostFactory scriptHostFactory, ILogProvider logProvider)
 {
     Guard.AgainstNullArgument("logProvider", logProvider);
     ScriptOptions = new ScriptOptions().WithReferences(typeof(Object).Assembly);
     _scriptHostFactory = scriptHostFactory;
     _log = logProvider.ForCurrentType();
 }
开发者ID:scriptcs,项目名称:scriptcs,代码行数:7,代码来源:CommonScriptEngine.cs

示例12: RoslynScriptEngine

 public RoslynScriptEngine(IScriptHostFactory scriptHostFactory, ILog logger)
 {
     _scriptEngine = new ScriptEngine();
     _scriptEngine.AddReference(typeof(ScriptExecutor).Assembly);
     _scriptHostFactory = scriptHostFactory;
     _logger = logger;
 }
开发者ID:ChowZenki,项目名称:scriptcs,代码行数:7,代码来源:RoslynScriptEngine.cs

示例13: FilesEventPersistence

        public FilesEventPersistence(
            ILog log,
            IJsonSerializer jsonSerializer,
            IFilesEventStoreConfiguration configuration,
            IFilesEventLocator filesEventLocator)
        {
            _log = log;
            _jsonSerializer = jsonSerializer;
            _filesEventLocator = filesEventLocator;
            _logFilePath = Path.Combine(configuration.StorePath, "Log.store");

            if (File.Exists(_logFilePath))
            {
                var json = File.ReadAllText(_logFilePath);
                var eventStoreLog = _jsonSerializer.Deserialize<EventStoreLog>(json);
                _globalSequenceNumber = eventStoreLog.GlobalSequenceNumber;
                _eventLog = eventStoreLog.Log ?? new Dictionary<long, string>();

                if (_eventLog.Count != _globalSequenceNumber)
                {
                    eventStoreLog = RecreateEventStoreLog(configuration.StorePath);
                    _globalSequenceNumber = eventStoreLog.GlobalSequenceNumber;
                    _eventLog = eventStoreLog.Log;
                }
            }
            else
            {
                _eventLog = new Dictionary<long, string>();
            }
        }
开发者ID:liemqv,项目名称:EventFlow,代码行数:30,代码来源:FilesEventPersistence.cs

示例14: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        _logging = IoC.IoC.Get<ILog>();
        _date = IoC.IoC.Get<IDate>();
        _settings = IoC.IoC.Get<ISettings>();
        _emailNotificationItems = IoC.IoC.Get<IEmailNotificationItems>();
        _sendEmail = IoC.IoC.Get<IEmail>();
        _status = IoC.IoC.Get<IStatus>();

        var url = Request.Url.AbsoluteUri;

        if (Request.QueryString["csvfile"] == null)
        {
            numberOfRun += 1;
            _logging.Msg("CroneJob startet, " + numberOfRun);
            if (DateTime.Now.Hour == 8)
            {
                _sendEmail.SendEmail("[email protected]", "[email protected]", "Cronejob startet kl. 8:00, antal gange det er kørt siden sidst: " + numberOfRun, "");
                numberOfRun = 0;
            }
            url = null;
        }

        Run(url);
    }
开发者ID:NNSostack,项目名称:DataJuggling,代码行数:25,代码来源:Notification.ascx.cs

示例15: JobStore

        /// <summary>
        /// Initializes a new instance of the <see cref="JobStore"/> class.
        /// </summary>
        public JobStore()
        {
            log = LogManager.GetLogger(GetType());

            string connectionString;

            if( ConfigurationManager.ConnectionStrings["quartznet-mongodb"] != null )
                connectionString = ConfigurationManager.ConnectionStrings["quartznet-mongodb"].ConnectionString;
            else
                connectionString = DefaultConnectionString;

            //
            // If there is no connection string to use then throw an 
            // exception to abort construction.
            //

            if (string.IsNullOrWhiteSpace(connectionString))
                throw new ApplicationException("Connection string is missing for the MongoDB job store.");

            lock (lockObject)
            {
                var urlBuilder = new MongoUrlBuilder(connectionString);
                var client = new MongoClient(urlBuilder.ToMongoUrl());
                this.database = client.GetServer().GetDatabase(urlBuilder.DatabaseName);
            }
        }
开发者ID:Jiangew,项目名称:quartz.net-mongodb,代码行数:29,代码来源:JobStore.cs


注:本文中的ILog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。