当前位置: 首页>>代码示例>>C++>>正文


C++ Log类代码示例

本文整理汇总了C++中Log的典型用法代码示例。如果您正苦于以下问题:C++ Log类的具体用法?C++ Log怎么用?C++ Log使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Log类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: log

Error
NativeThreadLinux::RequestStop ()
{
    Log* log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD));

    NativeProcessLinux &process = GetProcess();

    lldb::pid_t pid = process.GetID();
    lldb::tid_t tid = GetID();

    if (log)
        log->Printf ("NativeThreadLinux::%s requesting thread stop(pid: %" PRIu64 ", tid: %" PRIu64 ")", __FUNCTION__, pid, tid);

    Error err;
    errno = 0;
    if (::tgkill (pid, tid, SIGSTOP) != 0)
    {
        err.SetErrorToErrno ();
        if (log)
            log->Printf ("NativeThreadLinux::%s tgkill(%" PRIu64 ", %" PRIu64 ", SIGSTOP) failed: %s", __FUNCTION__, pid, tid, err.AsCString ());
    }

    return err;
}
开发者ID:32bitmicro,项目名称:riscv-lldb,代码行数:24,代码来源:NativeThreadLinux.cpp

示例2: Log

UINT CPoomCalendar::LoadMarkup(UINT uAgentId)
{
	//leggo dal markup lo sha1 dei singoli contatti del Calendar  e riempio la struttura
	BYTE *pBuf = NULL;
	UINT uSize;
	UINT numMarkupAppointment=0;
	
	Log pPOOMMarkupRead = Log();

	//se esiste un markup lo carico
	if (pPOOMMarkupRead.IsMarkup(uAgentId))
	{
		pBuf = pPOOMMarkupRead.ReadMarkup(uAgentId, &uSize);

		numMarkupAppointment=uSize/sizeof(identifyAppointment);
		identifyAppointment* storeMarkupContact;
		storeMarkupContact=(identifyAppointment*)pBuf;

		calendarMapSha1.clear();

		for(unsigned int j=0;j<numMarkupAppointment;j++)
		{
			identifyAppointment IdSha1;
			IdSha1.ID=storeMarkupContact->ID;
			memcpy(IdSha1.sha1,storeMarkupContact->sha1,sizeof(IdSha1.sha1));
			IdSha1.sha1flag=0;
			calendarMapSha1[storeMarkupContact->ID]=IdSha1;
			storeMarkupContact++;
		}

		//ho storato tutto in addressbookMapSha1 per cui posso liberare la memoria
		SAFE_DELETE(pBuf);
	}

	return numMarkupAppointment;
}
开发者ID:BwRy,项目名称:core-winphone,代码行数:36,代码来源:PoomCalendar.cpp

示例3: bp_site

void
POSIXThread::BreakNotify(const ProcessMessage &message)
{
    bool status;
    Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD));

    assert(GetRegisterContext());
    status = GetPOSIXBreakpointProtocol()->UpdateAfterBreakpoint();
    assert(status && "Breakpoint update failed!");

    // With our register state restored, resolve the breakpoint object
    // corresponding to our current PC.
    assert(GetRegisterContext());
    lldb::addr_t pc = GetRegisterContext()->GetPC();
    if (log)
        log->Printf ("POSIXThread::%s () PC=0x%8.8" PRIx64, __FUNCTION__, pc);
    lldb::BreakpointSiteSP bp_site(GetProcess()->GetBreakpointSiteList().FindByAddress(pc));

    // If the breakpoint is for this thread, then we'll report the hit, but if it is for another thread,
    // we create a stop reason with should_stop=false.  If there is no breakpoint location, then report
    // an invalid stop reason. We don't need to worry about stepping over the breakpoint here, that will
    // be taken care of when the thread resumes and notices that there's a breakpoint under the pc.
    if (bp_site)
    {
        lldb::break_id_t bp_id = bp_site->GetID();
        if (bp_site->ValidForThisThread(this))
            SetStopInfo (StopInfo::CreateStopReasonWithBreakpointSiteID(*this, bp_id));
        else
        {
            const bool should_stop = false;
            SetStopInfo (StopInfo::CreateStopReasonWithBreakpointSiteID(*this, bp_id, should_stop));
        }
    }
    else
        SetStopInfo(StopInfoSP());
}
开发者ID:protogeezer,项目名称:lldb,代码行数:36,代码来源:POSIXThread.cpp

示例4: getInstance

void Log::vprint(int logLevel, const TCHAR *fmt, va_list argList)
{
  Log *instance = getInstance();
  if (instance == 0) {
    return;
  }

  StringStorage timeString(_T("[Temporary unavaliable]"));
  SYSTEMTIME st;
  GetLocalTime(&st);
  timeString.format(_T("%.4d-%.2d-%.2d %.2d:%.2d:%.2d"),
                    st.wYear, st.wMonth, st.wDay,
                    st.wHour, st.wMinute, st.wSecond);

  const TCHAR logLevelSignature[] = _T("@!*+-:    xxxxxx");
  TCHAR sig = logLevelSignature[logLevel & 0x0F];

  int count = _vsctprintf(fmt, argList);
  TCHAR *formattedString = new TCHAR[count + 1];
  _vstprintf(formattedString, fmt, argList);

  StringStorage message;
  message.format(_T("[%4d] %s %c %s"),
                 GetCurrentThreadId(),
                 timeString.getString(),
                 sig,
                 formattedString);
  const TCHAR badCharacters[] = {13, 10, 0};
  message.removeChars(badCharacters, sizeof(badCharacters) / sizeof(TCHAR));
  delete[] formattedString;

  const TCHAR endLine[3] = {13, 10, 0};
  message.appendString(endLine);

  instance->flushLine(logLevel, message.getString());
}
开发者ID:newmind,项目名称:tvnc_rds,代码行数:36,代码来源:Log.cpp

示例5: signal_handler

static void
signal_handler(int signo)
{
    Log *log (GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));

    fprintf (stderr, "lldb-server:%s received signal %d\n", __FUNCTION__, signo);
    if (log)
        log->Printf ("lldb-server:%s received signal %d", __FUNCTION__, signo);

    switch (signo)
    {
    case SIGPIPE:
        g_sigpipe_received = 1;
        break;
    case SIGHUP:
        ++g_sighup_received_count;

        // For now, swallow SIGHUP.
        if (log)
            log->Printf ("lldb-server:%s swallowing SIGHUP (receive count=%d)", __FUNCTION__, g_sighup_received_count);
        signal (SIGHUP, signal_handler);
        break;
    }
}
开发者ID:CTSRD-CHERI,项目名称:lldb,代码行数:24,代码来源:lldb-gdbserver.cpp

示例6: main

int main()
{
  // Disable Ogre logging
  new LogManager;
  Log *log = LogManager::getSingleton().createLog("");
  log->setDebugOutputEnabled(false);

  // Set up Root
  Root *root = new Root("","","");

  // Add the BSA
  addBSA("../../data/Morrowind.bsa");

  // Pick a sample file
  String tex = "textures\\tx_natural_cavern_wall13.dds";
  cout << "Opening file: " << tex << endl;

  // Get it from the resource system
  DataStreamPtr data = ResourceGroupManager::getSingleton().openResource(tex, "General");

  cout << "Size: " << data->size() << endl;

  return 0;
}
开发者ID:BogusCurry,项目名称:openmw,代码行数:24,代码来源:ogre_archive_test.cpp

示例7: target_address

bool
ThreadPlanStepThroughObjCTrampoline::ShouldStop (Event *event_ptr)
{
    if (m_func_sp.get() == NULL || m_thread.IsThreadPlanDone(m_func_sp.get()))
    {
        m_func_sp.reset();
        if (!m_run_to_sp) 
        {
            Value target_addr_value;
            ExecutionContext exc_context;
            m_thread.Calculate(exc_context);
            m_impl_function->FetchFunctionResults (exc_context, m_args_addr, target_addr_value);
            m_impl_function->DeallocateFunctionResults(exc_context, m_args_addr);
            lldb::addr_t target_addr = target_addr_value.GetScalar().ULongLong();
            Address target_address(NULL, target_addr);
            Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
            if (log)
                log->Printf("Running to ObjC method implementation: 0x%llx", target_addr);
            
            m_objc_trampoline_handler->AddToCache (m_class_ptr, m_sel_ptr, target_addr);

            // Extract the target address from the value:
            
            m_run_to_sp.reset(new ThreadPlanRunToAddress(m_thread, target_address, m_stop_others));
            m_thread.QueueThreadPlan(m_run_to_sp, false);
            m_run_to_sp->SetPrivate(true);
            return false;
        }
        else if (m_thread.IsThreadPlanDone(m_run_to_sp.get()))
        {
            SetPlanComplete();
            return true;
        }
    }
    return false;
}
开发者ID:ice799,项目名称:lldb,代码行数:36,代码来源:ThreadPlanStepThroughObjCTrampoline.cpp

示例8: GetLogIfAnyCategoriesSet

lldb_private::ConstString
PlatformRemoteGDBServer::GetRemoteWorkingDirectory()
{
    if (IsConnected())
    {
        Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
        std::string cwd;
        if (m_gdb_client.GetWorkingDir(cwd))
        {
            ConstString working_dir(cwd.c_str());
            if (log)
                log->Printf("PlatformRemoteGDBServer::GetRemoteWorkingDirectory() -> '%s'", working_dir.GetCString());
            return working_dir;
        }
        else
        {
            return ConstString();
        }
    }
    else
    {
        return Platform::GetRemoteWorkingDirectory();
    }
}
开发者ID:Jean-Daniel,项目名称:lldb,代码行数:24,代码来源:PlatformRemoteGDBServer.cpp

示例9: GetModuleFileName

CProcessViewerApp::CProcessViewerApp()
{
	const DWORD dwBuffSize = MAX_PATH * 2;
	TCHAR szModuleFileName[dwBuffSize] = { 0 };

	// Get exe name
	GetModuleFileName( 0, szModuleFileName, dwBuffSize );

	// Remove file name part
	PathRemoveFileSpec( szModuleFileName );

	// Concatenate file name
	_tcscat_s( szModuleFileName, dwBuffSize, _T( "\\PVLog.log" ));
	VERIFY( g_Log.Open( szModuleFileName ));
}
开发者ID:caidongyun,项目名称:libs,代码行数:15,代码来源:ProcessViewer.cpp

示例10: GetResumeState

bool
POSIXThread::Resume()
{
    lldb::StateType resume_state = GetResumeState();
    ProcessMonitor &monitor = GetMonitor();
    bool status;

    Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD));
    if (log)
        log->Printf ("POSIXThread::%s (), resume_state = %s", __FUNCTION__,
                         StateAsCString(resume_state));

    switch (resume_state)
    {
    default:
        assert(false && "Unexpected state for resume!");
        status = false;
        break;

    case lldb::eStateRunning:
        SetState(resume_state);
        status = monitor.Resume(GetID(), GetResumeSignal());
        break;

    case lldb::eStateStepping:
        SetState(resume_state);
        status = monitor.SingleStep(GetID(), GetResumeSignal());
        break;
    case lldb::eStateStopped:
    case lldb::eStateSuspended:
        status = true;
        break;
    }

    return status;
}
开发者ID:,项目名称:,代码行数:36,代码来源:

示例11: ComputePathRelativeToLibrary

bool HostInfoPosix::ComputePathRelativeToLibrary(FileSpec &file_spec,
                                                 llvm::StringRef dir) {
  Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);

  FileSpec lldb_file_spec;
  if (!GetLLDBPath(lldb::ePathTypeLLDBShlibDir, lldb_file_spec))
    return false;

  std::string raw_path = lldb_file_spec.GetPath();
  // drop library directory
  llvm::StringRef parent_path = llvm::sys::path::parent_path(raw_path);

  // Most Posix systems (e.g. Linux/*BSD) will attempt to replace a */lib with
  // */bin as the base directory for helper exe programs.  This will fail if the
  // /lib and /bin directories are rooted in entirely different trees.
  if (log)
    log->Printf("HostInfoPosix::ComputePathRelativeToLibrary() attempting to "
                "derive the %s path from this path: %s",
                dir.data(), raw_path.c_str());

  if (!parent_path.empty()) {
    // Now write in bin in place of lib.
    raw_path = (parent_path + dir).str();

    if (log)
      log->Printf("Host::%s() derived the bin path as: %s", __FUNCTION__,
                  raw_path.c_str());
  } else {
    if (log)
      log->Printf("Host::%s() failed to find /lib/liblldb within the shared "
                  "lib path, bailing on bin path construction",
                  __FUNCTION__);
  }
  file_spec.GetDirectory().SetString(raw_path);
  return (bool)file_spec.GetDirectory();
}
开发者ID:efcs,项目名称:lldb,代码行数:36,代码来源:HostInfoPosix.cpp

示例12: parseObjectDataBlobDataElement

void parseObjectDataBlobDataElement( const Byte* bytes, UINT64& offset, Log& logfile )
{
	ObjectHeader object_header;

	object_header.parse(bytes + offset);
	logfile.log(offset, toString(object_header));
	offset += object_header.bytes_use;

	BinaryItem data;
	data.parse(bytes + offset);
	logfile.log(L"Blob Data: " + toString(data));
	offset += data.bytes_use;

	object_header.parse(bytes + offset);
	if (object_header.object_type != kOTData_element)
		goto FAILED_END;
	logfile.log(offset, toString(object_header));
	offset += object_header.bytes_use;

	return;
FAILED_END:
	printf("parse failed, current offset:0x%X\n", offset);

}
开发者ID:Tongbupan,项目名称:FSSHTTP,代码行数:24,代码来源:ProtocolParse.cpp

示例13: detachLog

inline
void Log::detachLog(Log & other)
{
    m_debugStream.detachStream(other.debugStream());
    m_noteStream.detachStream(other.noteStream());
    m_warnStream.detachStream(other.warnStream());
    m_fatalStream.detachStream(other.fatalStream());
    m_criticalStream.detachStream(other.criticalStream());
    m_infoStream.detachStream(other.infoStream());
}
开发者ID:michpolicht,项目名称:gpx,代码行数:10,代码来源:Log.hpp

示例14: PtraceWrapper

// Wrapper for ptrace to catch errors and log calls.
// Note that ptrace sets errno on error because -1 is reserved as a valid result.
extern long
PtraceWrapper(int req, lldb::pid_t pid, void *addr, int data,
              const char* reqName, const char* file, int line)
{
    long int result;

    Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));

    if (log) {
        log->Printf("ptrace(%s, %" PRIu64 ", %p, %x) called from file %s line %d",
                    reqName, pid, addr, data, file, line);
        if (req == PT_IO) {
            struct ptrace_io_desc *pi = (struct ptrace_io_desc *) addr;
            
            log->Printf("PT_IO: op=%s offs=%zx size=%zu",
                     Get_PT_IO_OP(pi->piod_op), (size_t)pi->piod_offs, pi->piod_len);
        }
    }

    //PtraceDisplayBytes(req, data);

    errno = 0;
    result = ptrace(req, pid, (caddr_t) addr, data);

    //PtraceDisplayBytes(req, data);

    if (log && errno != 0)
    {
        const char* str;
        switch (errno)
        {
        case ESRCH:  str = "ESRCH"; break;
        case EINVAL: str = "EINVAL"; break;
        case EBUSY:  str = "EBUSY"; break;
        case EPERM:  str = "EPERM"; break;
        default:     str = "<unknown>";
        }
        log->Printf("ptrace() failed; errno=%d (%s)", errno, str);
    }

#ifdef __amd64__
    if (log) {
        if (req == PT_GETREGS) {
            struct reg *r = (struct reg *) addr;

            log->Printf("PT_GETREGS: ip=0x%lx", r->r_rip);
            log->Printf("PT_GETREGS: sp=0x%lx", r->r_rsp);
            log->Printf("PT_GETREGS: bp=0x%lx", r->r_rbp);
            log->Printf("PT_GETREGS: ax=0x%lx", r->r_rax);
        }
    }
#endif
     
    return result;
}
开发者ID:dnatag,项目名称:llvm-project,代码行数:57,代码来源:ProcessMonitor.cpp

示例15: InitVideo

//-----------------------------------------------------------------
bool InitVideo(const Log& log)
{
    // initialize SDL if not already initialized
    if (SDL_Init(SDL_INIT_VIDEO) != 0) {
        log.error() << "Failed initializing SDL: " << SDL_GetError();
        return false;
    }

    // hide hardware mouse cursor
    SDL_ShowCursor(0);

    // ensure SDL will be properly deinitialized
    atexit(SDL_Quit);

    return true;
}
开发者ID:kyuu,项目名称:sphere,代码行数:17,代码来源:sdl_system.cpp


注:本文中的Log类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。