Compare commits
	
		
			2 Commits
		
	
	
		
			8fcddba591
			...
			c2a5995e7e
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					c2a5995e7e | ||
| 
						 | 
					152c8b6719 | 
							
								
								
									
										3
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							@ -4,6 +4,7 @@
 | 
			
		||||
        "iosfwd": "cpp",
 | 
			
		||||
        "fstream": "cpp",
 | 
			
		||||
        "*.tcc": "cpp",
 | 
			
		||||
        "ostream": "cpp"
 | 
			
		||||
        "ostream": "cpp",
 | 
			
		||||
        "mutex": "cpp"
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										3
									
								
								example/2023-07-27.log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								example/2023-07-27.log
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
18:29:30 [EVENT] Start loging
 | 
			
		||||
18:29:44 [EVENT] Start loging
 | 
			
		||||
18:29:47 [EVENT] Start loging
 | 
			
		||||
@ -7,6 +7,7 @@
 | 
			
		||||
#include <fstream>
 | 
			
		||||
#include <time.h>
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
#include <mutex>
 | 
			
		||||
 | 
			
		||||
using namespace std;
 | 
			
		||||
 | 
			
		||||
@ -19,6 +20,7 @@ class log {
 | 
			
		||||
    struct tm * moment;
 | 
			
		||||
    uint day;
 | 
			
		||||
    string path;
 | 
			
		||||
    mutex io;
 | 
			
		||||
 | 
			
		||||
    log (string _dir, bool _isKeepOpen = true, bool _printInConsole = false);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -43,6 +43,7 @@ void log::setMoment() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void log::put(string logline) {
 | 
			
		||||
   io.lock();
 | 
			
		||||
   if (printInConsole) {
 | 
			
		||||
      cout << logline << endl;
 | 
			
		||||
   }
 | 
			
		||||
@ -74,6 +75,7 @@ void log::put(string logline) {
 | 
			
		||||
   if (!isKeepOpen && logfile.is_open()) {
 | 
			
		||||
      loose();
 | 
			
		||||
   }
 | 
			
		||||
   io.unlock();
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1 +1 @@
 | 
			
		||||
g++ test.cpp ../src/* -o test.o -l sqlite3
 | 
			
		||||
g++ test.cpp ../src/* -o test.o
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								test/test.o
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								test/test.o
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user