本文整理汇总了C++中LogFormat函数的典型用法代码示例。如果您正苦于以下问题:C++ LogFormat函数的具体用法?C++ LogFormat怎么用?C++ LogFormat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LogFormat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadLanguageFile
static bool
LoadLanguageFile(const TCHAR *path)
{
#ifdef HAVE_NATIVE_GETTEXT
/* not supported on UNIX */
return false;
#else /* !HAVE_NATIVE_GETTEXT */
LogFormat(_T("Language: loading file '%s'"), path);
delete mo_loader;
mo_loader = new MOLoader(path);
if (mo_loader->error()) {
LogFormat(_T("Language: could not load file '%s'"), path);
delete mo_loader;
mo_loader = NULL;
return false;
}
LogFormat(_T("Loaded translations from file '%s'"), path);
mo_file = &mo_loader->get();
return true;
#endif /* !HAVE_NATIVE_GETTEXT */
}
示例2: LogFormat
void
Display::LoadOrientation(VerboseOperationEnvironment &env)
{
if (!Display::RotateSupported())
return;
Display::RotateInitialize();
DisplayOrientation orientation =
CommonInterface::GetUISettings().display.orientation;
#ifdef KOBO
/* on the Kobo, the display orientation must be loaded explicitly
(portrait), because the hardware default is landscape */
#else
if (orientation == DisplayOrientation::DEFAULT)
return;
#endif
if (!Display::Rotate(orientation)) {
LogFormat("Display rotation failed");
return;
}
#ifdef KOBO
event_queue->SetMouseRotation(orientation);
#endif
LogFormat("Display rotated");
CommonInterface::main_window->Initialise();
/* force the progress dialog to update its layout */
env.UpdateLayout();
}
示例3: assert
bool
ALSAPCMPlayer::TryRecoverFromError(snd_pcm_t &alsa_handle, int error)
{
assert(error < 0);
if (-EPIPE == error)
LogFormat("ALSA PCM buffer underrun");
else if ((-EINTR == error) || (-ESTRPIPE == error))
LogFormat("ALSA PCM error: %s - trying to recover",
snd_strerror(error));
else {
// snd_pcm_recover() can only handle EPIPE, EINTR and ESTRPIPE
LogFormat("Unrecoverable ALSA PCM error: %s",
snd_strerror(error));
return false;
}
int recover_error = snd_pcm_recover(&alsa_handle, error, 1);
if (0 == recover_error) {
LogFormat("ALSA PCM successfully recovered");
return true;
} else {
LogFormat("snd_pcm_recover(0x%p, %d, 1) failed: %d - %s",
&alsa_handle,
error,
recover_error,
snd_strerror(recover_error));
return false;
}
}
示例4: CheckLogCat
void
CheckLogCat(IOThread &io_thread)
{
LogFormat("Launching logcat");
FileDescriptor r, w;
if (!FileDescriptor::CreatePipe(r, w))
return;
pid_t pid = fork();
if (pid == 0) {
/* in the child process */
w.Duplicate(1);
execl("/system/bin/logcat", "logcat", "-v", "threadtime",
"-d", "-t", "1000", NULL);
_exit(EXIT_FAILURE);
}
if (pid < 0) {
LogFormat("Launching logcat has failed: %s", strerror(errno));
return;
}
log_cat_reader = new LogCatReader(io_thread, std::move(r), pid);
}
示例5: ReadResourceLanguageFile
static bool
ReadResourceLanguageFile(const TCHAR *resource)
{
if (!FindLanguage(resource))
/* refuse to load resources which are not in the language table */
return false;
LogFormat(_T("Language: loading resource '%s'"), resource);
// Load resource
ResourceLoader::Data data = ResourceLoader::Load(resource, _T("MO"));
if (data.first == NULL) {
LogFormat(_T("Language: resource '%s' not found"), resource);
return false;
}
// Load MO file from resource
delete mo_loader;
mo_loader = new MOLoader(data.first, data.second);
if (mo_loader->error()) {
LogFormat(_T("Language: could not load resource '%s'"), resource);
delete mo_loader;
mo_loader = NULL;
return false;
}
LogFormat(_T("Loaded translations from resource '%s'"), resource);
mo_file = &mo_loader->get();
return true;
}
示例6: LogFormat
Port::WaitResult
DumpPort::WaitRead(unsigned timeout_ms)
{
LogFormat("WaitRead %u", timeout_ms);
Port::WaitResult result = port->WaitRead(timeout_ms);
LogFormat("WaitRead %u = %d", timeout_ms, (int)result);
return result;
}
示例7: StartupLogFreeRamAndStorage
void
StartupLogFreeRamAndStorage()
{
#ifdef HAVE_MEM_INFO
unsigned long freeram = SystemFreeRAM() / 1024;
LogFormat("Free ram %lu KB", freeram);
#endif
unsigned long freestorage = FindFreeSpace(GetPrimaryDataPath());
LogFormat("Free storage %lu KB", freestorage);
}
示例8: CheckEnabled
Port::WaitResult
DumpPort::WaitRead(unsigned timeout_ms)
{
const bool enabled = CheckEnabled();
if (enabled)
LogFormat("WaitRead %u", timeout_ms);
Port::WaitResult result = port->WaitRead(timeout_ms);
if (enabled)
LogFormat("WaitRead %u = %d", timeout_ms, (int)result);
return result;
}
示例9: devStartup
void
devStartup()
{
LogFormat("Register serial devices");
const SystemSettings &settings = CommonInterface::GetSystemSettings();
bool none_available = true;
for (unsigned i = 0; i < NUMDEV; ++i) {
DeviceDescriptor &device = *device_list[i];
const DeviceConfig &config = settings.devices[i];
if (!config.IsAvailable()) {
device.ClearConfig();
continue;
}
none_available = false;
bool overlap = false;
for (unsigned j = 0; j < i; ++j)
if (DeviceConfigOverlaps(config, device_list[j]->GetConfig()))
overlap = true;
if (overlap) {
device.ClearConfig();
continue;
}
device.SetConfig(config);
devInitOne(*device_list[i]);
}
if (none_available) {
#ifdef ANDROID
/* fall back to built-in GPS when no configured device is
available on this platform */
LogFormat("Falling back to built-in GPS");
DeviceConfig config;
config.Clear();
config.port_type = DeviceConfig::PortType::INTERNAL;
DeviceDescriptor &device = *device_list[0];
device.SetConfig(config);
devInitOne(device);
#endif
}
}
示例10: ReadLanguageFile
/**
* Reads the selected LanguageFile into the cache
*/
void
ReadLanguageFile()
{
#ifndef HAVE_NATIVE_GETTEXT
CloseLanguageFile();
LogFormat("Loading language file");
TCHAR buffer[MAX_PATH], second_buffer[MAX_PATH];
const TCHAR *value = Profile::GetPath(ProfileKeys::LanguageFile, buffer)
? buffer : _T("");
if (StringIsEqual(value, _T("none")))
return;
if (StringIsEmpty(value) || StringIsEqual(value, _T("auto"))) {
AutoDetectLanguage();
return;
}
const TCHAR *base = BaseName(value);
if (base == NULL)
base = value;
if (base == value) {
LocalPath(second_buffer, value);
value = second_buffer;
}
if (!LoadLanguageFile(value) && !ReadResourceLanguageFile(base))
AutoDetectLanguage();
#endif
}
示例11: LogFormat
EXPORT_C void CImMobilityLogger::LogText(TInt /*aFilePos*/, const TDesC8& /*aText*/)
#endif //__IM_MOBILITY_LOGGING
{
#ifdef __IM_MOBILITY_LOGGING
LogFormat(aFilePos, KTxtFormatText, &aText);
#endif //__IM_MOBILITY_LOGGING
}
示例12: LocalPath
bool
WaypointGlue::SaveWaypoints(const Waypoints &way_points)
{
const auto path = LocalPath(_T("user.cup"));
TextWriter writer(path);
if (!writer.IsOpen()) {
LogFormat(_T("Waypoint file '%s' can not be written"), path.c_str());
return false;
}
WriteCup(writer, way_points, WaypointOrigin::USER);
LogFormat(_T("Waypoint file '%s' saved"), path.c_str());
return true;
}
示例13: LogFormat
void
LoggerImpl::StopLogger(const NMEAInfo &gps_info)
{
// Logger can't be switched off if already off -> cancel
if (writer == nullptr)
return;
writer->Flush();
if (!simulator)
writer->Sign();
writer->Flush();
LogFormat(_T("Logger stopped: %s"), filename.c_str());
// Logger off
delete writer;
writer = nullptr;
// Make space for logger file, if unsuccessful -> cancel
if (gps_info.gps.real && gps_info.date_time_utc.IsDatePlausible())
IGCFileCleanup(gps_info.date_time_utc.year);
pre_takeoff_buffer.clear();
}
示例14: LogFormat
bool
WaypointGlue::LoadWaypoints(Waypoints &way_points,
const RasterTerrain *terrain,
OperationEnvironment &operation)
{
LogFormat("ReadWaypoints");
operation.SetText(_("Loading Waypoints..."));
bool found = false;
// Delete old waypoints
way_points.Clear();
TCHAR path[MAX_PATH];
LoadWaypointFile(way_points, LocalPath(path, _T("user.cup")),
WaypointFileType::SEEYOU,
WaypointOrigin::USER, terrain, operation);
// ### FIRST FILE ###
if (Profile::GetPath(ProfileKeys::WaypointFile, path))
found |= LoadWaypointFile(way_points, path, WaypointOrigin::PRIMARY,
terrain, operation);
// ### SECOND FILE ###
if (Profile::GetPath(ProfileKeys::AdditionalWaypointFile, path))
found |= LoadWaypointFile(way_points, path, WaypointOrigin::ADDITIONAL,
terrain, operation);
// ### WATCHED WAYPOINT/THIRD FILE ###
if (Profile::GetPath(ProfileKeys::WatchedWaypointFile, path))
found |= LoadWaypointFile(way_points, path, WaypointOrigin::WATCHED,
terrain, operation);
// ### MAP/FOURTH FILE ###
// If no waypoint file found yet
if (!found) {
auto dir = OpenMapFile();
if (dir != nullptr) {
found |= LoadWaypointFile(way_points, dir, "waypoints.xcw",
WaypointFileType::WINPILOT,
WaypointOrigin::MAP,
terrain, operation);
found |= LoadWaypointFile(way_points, dir, "waypoints.cup",
WaypointFileType::SEEYOU,
WaypointOrigin::MAP,
terrain, operation);
zzip_dir_close(dir);
}
}
// Optimise the waypoint list after attaching new waypoints
way_points.Optimise();
// Return whether waypoints have been loaded into the waypoint list
return found;
}
示例15: ReadAssetNumber
void
ReadAssetNumber()
{
#ifdef _WIN32_WCE
if (ReadCompaqID()) {
LogFormat(_T("Asset ID: %s (compaq)"), asset_number);
} else if (ReadUUID()) {
LogFormat(_T("Asset ID: %s (uuid)"), asset_number);
} else {
#endif
_tcscpy(asset_number, _T("AAA"));
#ifdef _WIN32_WCE
LogFormat(_T("Asset ID: %s (fallback)"), asset_number);
}
#endif
}