mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-01 13:42:53 +02:00
write logs on stdout instead of stderr
This commit is contained in:
parent
35ce743b39
commit
e3f011b724
|
@ -5,10 +5,15 @@ bool verbose;
|
|||
|
||||
void log(T...)(T args)
|
||||
{
|
||||
stderr.writeln(args);
|
||||
writeln(args);
|
||||
}
|
||||
|
||||
void vlog(T...)(T args)
|
||||
{
|
||||
if (verbose) stderr.writeln(args);
|
||||
if (verbose) writeln(args);
|
||||
}
|
||||
|
||||
void error(T...)(T args)
|
||||
{
|
||||
stderr.writeln(args);
|
||||
}
|
|
@ -46,8 +46,8 @@ int main(string[] args)
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
} catch (GetOptException e) {
|
||||
log.log(e.msg);
|
||||
log.log("Try 'onedrive -h' for more information");
|
||||
log.error(e.msg);
|
||||
log.error("Try 'onedrive -h' for more information");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -85,13 +85,13 @@ int main(string[] args)
|
|||
log.vlog("Initializing the OneDrive API ...");
|
||||
bool online = testNetwork();
|
||||
if (!online && !monitor) {
|
||||
log.log("No network connection");
|
||||
log.error("No network connection");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
auto onedrive = new OneDriveApi(cfg);
|
||||
onedrive.printAccessToken = printAccessToken;
|
||||
if (!onedrive.init()) {
|
||||
log.log("Could not initialize the OneDrive API");
|
||||
log.error("Could not initialize the OneDrive API");
|
||||
// workaround for segfault in std.net.curl.Curl.shutdown() on exit
|
||||
onedrive.http.shutdown();
|
||||
return EXIT_FAILURE;
|
||||
|
|
Loading…
Reference in a new issue