NSLog without date time stamp, application name, and process id info.

New trick that how to hide  date time stamp, application name, and process id info, when you are going to print your information through NSLogs.

The NSLogs original output is

But you can modify it to more simple way:

Just follow the steps below:

Step 1: Create a Constant.h file in your project. First Right click on your project name

Screen Shot 2013-11-20 at 11.11.42 am


then Select C/C++ under iOS section and Select a header file.

Screen Shot 2013-10-29 at 6.32.23 PM

Then Name it as Constants.h and Add this file to your project.

Step 2: Now open the Constants.h file and write the following code there:

Here another one good think is store NSLog into Text file using macro.

Step 3 : After adding this code in Constants.h file, open the Prefix.pch file in your project . You can find it in Supporting Files group in Project navigator.

By adding this file here you do not have need to import this file in every file.

All set now. What you have to do is to implement the new NSLog method and there it is your new logs without timestamps and processIds..!!

This entry was posted in iPhone Development by Nimit Parekh. Bookmark the permalink.

About Nimit Parekh

Hey ! I am Nimit S. Parekh a passionate mobile application developer from India.. I am always hunting for better knowledge in iOS. I am looking forward to be a good app & game developer. I keep on sharing my knowledge @ http://sugartin.info as soon as I get spare time for it. I would love to hear your personal feedback about this blog.

Leave a Reply

Your email address will not be published. Required fields are marked *