mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-24 08:20:03 +02:00
dd73ae3c4b
* Fix 4xx errors including (412 pre-condition) * Add Logging - log to a file (/var/log/onedrive/onedrive.log) * Add http(s) debugging as a flag * Add dont sync when just blindly running the application * Add individual folder sync - ie ~/OneDrive/blah/ vs. syncing everything in ~/OneDrive/ * Add sync from local directory first rather than download first then upload * Add upload long path check (430 character limitation)
44 lines
1 KiB
D
44 lines
1 KiB
D
import std.stdio;
|
|
import std.file;
|
|
import std.datetime;
|
|
|
|
// enable verbose logging
|
|
bool verbose;
|
|
|
|
void log(T...)(T args)
|
|
{
|
|
writeln(args);
|
|
// Write to log file
|
|
string logFileName = "/var/log/onedrive/onedrive.log";
|
|
auto currentTime = Clock.currTime();
|
|
auto timeString = currentTime.toString();
|
|
File logFile = File(logFileName, "a");
|
|
logFile.writeln(timeString, " ", args);
|
|
logFile.close();
|
|
}
|
|
|
|
void vlog(T...)(T args)
|
|
{
|
|
if (verbose) {
|
|
writeln(args);
|
|
// Write to log file
|
|
string logFileName = "/var/log/onedrive/onedrive.log";
|
|
auto currentTime = Clock.currTime();
|
|
auto timeString = currentTime.toString();
|
|
File logFile = File(logFileName, "a");
|
|
logFile.writeln(timeString, " ", args);
|
|
logFile.close();
|
|
}
|
|
}
|
|
|
|
void error(T...)(T args)
|
|
{
|
|
stderr.writeln(args);
|
|
// Write to log file
|
|
string logFileName = "/var/log/onedrive/onedrive.log";
|
|
auto currentTime = Clock.currTime();
|
|
auto timeString = currentTime.toString();
|
|
File logFile = File(logFileName, "a");
|
|
logFile.writeln(timeString, " ", args);
|
|
logFile.close();
|
|
} |