NSLog()输出中的方括号中的数字是什么? [英] What are the numbers in the square brackets in NSLog() output?

查看:673
本文介绍了NSLog()输出中的方括号中的数字是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的日志消息中的 [] 之间的东西是什么?我在我的iPhone应用程序,我不知道消息是从哪里来的。

What is the stuff between the [] in the log message below? I get this in my iPhone app, and I have no idea where the message is coming from. My first guess would be a line number, but which file would it be in?

2010-10-19 08:56:12.006 Encore[376:6907]


推荐答案

进程ID,第二个是日志记录线程的Mach端口。桌面示例:

The first number is the process ID, the second is the logging thread's Mach port. A desktop example:

2010-10-19 17:37:13.189 nc_init[28617:a0f] nc <CFNotificationCenter 0x10010d170 [0x7fff70d96f20]> - default <CFNotificationCenter 0x10010d2a0 [0x7fff70d96f20]>

(gdb) i thread
Thread 1 has current state "WAITING"
    Mach port #0xa0f (gdb port #0x4203)
    frame 0: main () at nc_init.m:10
    pthread ID: 0x7fff70ebfc20
    system-wide unique thread id: 0x167b49
    dispatch queue name: "com.apple.main-thread"
    dispatch queue flags: 0x0
    total user time: 13232000
    total system time: 16099000
    scaled cpu usage percentage: 0
    scheduling policy in effect: 0x1
    run state: 0x3 (WAITING)
    flags: 0x0
    number of seconds that thread has slept: 0
    current priority: 31
    max priority: 63
    suspend count: 0.

(gdb) p/x (int)mach_thread_self()
$1 = 0xa0f

注意0xa0f如何被报告为线程的Mach端口。

Notice how 0xa0f is reported as the thread's Mach port.

这篇关于NSLog()输出中的方括号中的数字是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆