forked from microsoft/AirSim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add MavLinkLog interface that can be overridden.
add Log class that can redirect Utils::logMessage output. Fix various bugs.
- Loading branch information
1 parent
bd8429d
commit 3667cc5
Showing
21 changed files
with
299 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
#ifndef common_utils_Log_hpp | ||
#define common_utils_Log_hpp | ||
|
||
#include <cstdarg> | ||
#include <stdio.h> | ||
|
||
namespace common_utils { | ||
|
||
// This simple logging interface can be used to redirect debug printf statements to your own app's environment. | ||
class Log | ||
{ | ||
static Log* log_; | ||
public: | ||
|
||
static Log* getLog() { | ||
return log_; | ||
} | ||
|
||
static void setLog(Log* log) { | ||
log_ = log; | ||
} | ||
|
||
virtual void logMessage(const char* message) { | ||
printf(message); | ||
printf("\n"); | ||
fflush(stdout); | ||
} | ||
|
||
virtual void logError(const char* message) { | ||
fprintf(stderr, message); | ||
printf("\n"); | ||
fflush(stderr); | ||
} | ||
|
||
}; | ||
} | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// in header only mode, control library is not available | ||
#ifndef AIRLIB_HEADER_ONLY | ||
//if using Unreal Build system then include precompiled header file first | ||
#ifdef AIRLIB_PCH | ||
#include "AirSim.h" | ||
#endif | ||
|
||
#include "common/common_utils/Log.hpp" | ||
|
||
using namespace common_utils; | ||
|
||
// default implementation that can be overridden by the user via Log::setLog(). | ||
Log* Log::log_ = new Log(); | ||
|
||
#endif; |
Oops, something went wrong.