What is log handling in Objective C?

Overview

Objective-C language is an object-oriented programming language that can be used to send instant messages to the C language. Apple, iOS, OS X, and their particular APIs are used by this main programming language. NSLog FoundationKit used for displaying debug functions is used to print logs.

Syntax


Let's view the syntax of this method:

Void NSlog( NSString *format, ...)

In NSLog(@ " " ), NSlog is a foundation and @ is literal in C and it is compulsory to write; otherwise, there will be a compile-time error.

Code example

Let's look at the code example below:

#import <Foundation/Foundation.h>
int main() {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog(@"HI... what's up!");
NSLog(@"Log handling");
return 0;
[pool drain];
}

Code explanation

We import Foundation, which is a basic layer for working on applications in different perspectives like texting, editing, calculations, and many more.

  • Line 5: We use @, and print ( Hi…what’s up) with the help of NSlog.
  • Line 6: We use @, and print ( Log handling) with the help of NSlog.

Free Resources