本文整理汇总了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
}
}
示例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!"); }
}
}
示例3: CallMmCodeDataProvider
public CallMmCodeDataProvider(IAmDataProvider dataProvider, IReadOnlyRepository repository, ILogCommandTypes logCommand)
{
_log = LogManager.GetLogger(GetType());
_dataProvider = dataProvider;
_repository = repository;
_logCommand = logCommand;
}
示例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);
}
示例5: ApplicationContext
public ApplicationContext(string projectRoot, ProjectConfig projectConfig, UserConfig userConfig, ILog log)
{
mProjectRoot = projectRoot;
mProjectConfig = projectConfig;
mUserConfig = userConfig;
mLog = log;
}
示例6: EventStoreEventPersistence
public EventStoreEventPersistence(
ILog log,
IEventStoreConnection connection)
{
_log = log;
_connection = connection;
}
示例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;
}
示例8: SmtpClientSession
public SmtpClientSession(ILog log, SmtpClientSessionConfiguration configuration, MessageData messageData)
{
_log = log;
_configuration = configuration;
_messageData = messageData;
}
示例9: TaskActions
public TaskActions(RavenFileSystem fileSystem, ILog log)
: base(fileSystem, log)
{
timer = Observable.Interval(TimeSpan.FromMinutes(1));
InitializeTimer();
}
示例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("--");
}
示例11: CommonScriptEngine
protected CommonScriptEngine(IScriptHostFactory scriptHostFactory, ILogProvider logProvider)
{
Guard.AgainstNullArgument("logProvider", logProvider);
ScriptOptions = new ScriptOptions().WithReferences(typeof(Object).Assembly);
_scriptHostFactory = scriptHostFactory;
_log = logProvider.ForCurrentType();
}
示例12: RoslynScriptEngine
public RoslynScriptEngine(IScriptHostFactory scriptHostFactory, ILog logger)
{
_scriptEngine = new ScriptEngine();
_scriptEngine.AddReference(typeof(ScriptExecutor).Assembly);
_scriptHostFactory = scriptHostFactory;
_logger = logger;
}
示例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>();
}
}
示例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);
}
示例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);
}
}