mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-15 12:16:49 +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)
|
void log(T...)(T args)
|
||||||
{
|
{
|
||||||
stderr.writeln(args);
|
writeln(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vlog(T...)(T 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;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
} catch (GetOptException e) {
|
} catch (GetOptException e) {
|
||||||
log.log(e.msg);
|
log.error(e.msg);
|
||||||
log.log("Try 'onedrive -h' for more information");
|
log.error("Try 'onedrive -h' for more information");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,13 +85,13 @@ int main(string[] args)
|
||||||
log.vlog("Initializing the OneDrive API ...");
|
log.vlog("Initializing the OneDrive API ...");
|
||||||
bool online = testNetwork();
|
bool online = testNetwork();
|
||||||
if (!online && !monitor) {
|
if (!online && !monitor) {
|
||||||
log.log("No network connection");
|
log.error("No network connection");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
auto onedrive = new OneDriveApi(cfg);
|
auto onedrive = new OneDriveApi(cfg);
|
||||||
onedrive.printAccessToken = printAccessToken;
|
onedrive.printAccessToken = printAccessToken;
|
||||||
if (!onedrive.init()) {
|
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
|
// workaround for segfault in std.net.curl.Curl.shutdown() on exit
|
||||||
onedrive.http.shutdown();
|
onedrive.http.shutdown();
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
Loading…
Reference in a new issue