Updated Logger class

This commit is contained in:
JackCarterSmith 2017-10-15 09:31:30 +02:00
parent d7ff84d5ef
commit 6635225a8d
2 changed files with 3 additions and 3 deletions

View File

@ -7,7 +7,7 @@ Public Class Logger
Public Sub Load() Public Sub Load()
If Not My.Computer.FileSystem.DirectoryExists("logs") Then My.Computer.FileSystem.CreateDirectory("logs") If Not My.Computer.FileSystem.DirectoryExists("logs") Then My.Computer.FileSystem.CreateDirectory("logs")
If Not My.Computer.FileSystem.FileExists(logFileName) Then File.WriteAllLines(logFileName, {"LOG FILE - " & DateTime.Now.ToString("dd/MM/yyyy"), "--------------------", "[" & DateTime.Now.ToString("HH:mm:ss") & "][INFO] Loading software"}) If Not My.Computer.FileSystem.FileExists(logFileName) Then File.WriteAllLines(logFileName, {"--------------------------------------------------------------", "------------------- LOG FILE - " & DateTime.Now.ToString("dd/MM/yyyy") & " -------------------", "--------------------------------------------------------------", "[" & DateTime.Now.ToString("HH:mm:ss") & "][INFO] Init software"})
End Sub End Sub
Public Sub Info(str As String) Public Sub Info(str As String)

View File

@ -3,7 +3,7 @@ Imports System.Text
Imports System.IO Imports System.IO
Public Class Main Public Class Main
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) 'Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim manualID_selected As Boolean = False Dim manualID_selected As Boolean = False
Dim idList As New ArrayList Dim idList As New ArrayList
@ -11,6 +11,7 @@ Public Class Main
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
log.Load() log.Load()
log.Info("Check and load of database")
CheckIfFirstRun() CheckIfFirstRun()
ListAllInv() ListAllInv()
End Sub End Sub
@ -19,7 +20,6 @@ Public Class Main
''' Function to check if app is running for the first time ''' Function to check if app is running for the first time
''' </summary> ''' </summary>
Private Sub CheckIfFirstRun() Private Sub CheckIfFirstRun()
log.Info("Check and load of database")
If Not My.Computer.FileSystem.FileExists("db.sqlite") Then If Not My.Computer.FileSystem.FileExists("db.sqlite") Then
If MsgBox("La base de données SQLite est introuvable ou inaccessible, souhaitez-vous la régénérer ?", 4161, "Base SQLite absente ou inaccessible") = 1 Then If MsgBox("La base de données SQLite est introuvable ou inaccessible, souhaitez-vous la régénérer ?", 4161, "Base SQLite absente ou inaccessible") = 1 Then
RegenerateDB() RegenerateDB()