App42 Cloud API

C# Cloud SDK

Log

Centralize logging for your App. This service allows different levels e.g. info, debug, fatal, error etc. to log a message and query the messages based on different parameters. You can fetch logs based on module, level, message, date range etc.

In order to use the various functions available under a particular API, a developer will have to create an instance of ServiceAPI by passing the apiKey and the secretKey which has been received while creating an app.

	ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>");    

After initialization, developer needs to call the BuildXXXService method on ServiceAPI instance to get the instance of the particular API that you wish to build. For example, To build an instance of LogService, BuildLogService() method needs to be called.

	LogService logService = api.BuildLogService();

Once the API instance has been retrieved, You are ready to use the functions available for that particular API.

The methods available under a particular API will return the domain object (like Logs in this case) as a response which will have the accessor / mutator to access the available properties for that object. You can get the response in the form of JSON as well. We have provided the JSON response with every function detail which can be retrieved by calling the ToString() on the returned object.

String msg = "Info logs";
String module =	"testmod";

Log log = logService.Info(message,module);   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList(); 
for (int i = 0; i < messageList.Count; i++) 
{    
	Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime());
}  
String jsonResponse = log.ToString(); /* returns the response in JSON format. */ 
                            

The functions available under Logging API can throw some exceptions in abnormal conditions. Example of the same has been given below.

E.g. If App developer is requesting the logs for the module which is not in the database, the function will throw the App42Exception (as shown below) with message as "Not Found" and the AppErrorCode as "2700" and the details as "Logs for the module '<module>' does not exist".

String moduleName =	"testmod";	

try
{
	Log log = logService.FetchLogsByModule(moduleName);
}
catch(App42Exception ex) 
{
	int appErrorCode = ex.GetAppErrorCode();
	int httpErrorCode = ex.GetHttpErrorCode();
	if(appErrorCode == 2700)
    {
    // Handle here for Not Found (Logs for the module '<module>' does not exist.)
    }
    else if(appErrorCode == 1401)
	{
    // handle here for Client is not authorized
    }
    else if(appErrorCode == 1500)
	{
    // handle here for Internal Server Error
    }	
	String jsonText = ex.GetMessage(); /* returns the Exception text in JSON format. (as shown below)*/	
}       
							
	{
		"app42Fault": {
			"httpErrorCode": 404,
			"appErrorCode": 2700,
			"message": "Not Found",
			"details": "Logs for the module 'testmod' does not exist"
		}
	}			

Below are the HTTP Error Codes and their description, the function under the Logging API can throw.

/*
1400 - BAD REQUEST - The Request parameters are invalid
1401 - UNAUTHORIZED - Client is not authorized
1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again	
*/						

Below are the Application Error Codes and their description, the function under the Logging API can throw.

/*
2700 - NOT FOUND - Logs for the module '<module>' does not exist.
2701 - NOT FOUND - Logs for the type '<type>' does not exist.
2702 - Not Found - Logs betweem startDate '<startDate>' and endDate '<endDate>' does not exist.
2703 - NOT FOUND - Logs for the module '<module>' with text '<text>' does not exist.
2704 - NOT FOUND - The number of logs for the module '<module>' are less than the specified offset : <offset>.
2705 - NOT FOUND - The number of logs for the module '<module>' are less thanThe number of logs for the type '<type>' are less than the specified offset : <offset>.he specified offset : <offset>.
2706 - NOT FOUND - The number of logs betweem startDate '<startDate>' and endDate '<endDate>' are less than the specified offset : <offset>.
2707 - NOT FOUND - The number of logs for the module '<module>' with text '<text>' are less than the specified offset : <offset>.
*/			

Various functions available under Logging API has been explained below.

public Log Info(String msg, String module)

Logs the info message

Parameters:

msg - Message to be logged
module - Module name for which the message is getting logged

Returns:

Log object containing logged message

Response: Log Object

For more details click Exception
String msg = "Info logs";
String module =	"testmod";		

Log log = logService.Info(message,module);   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList();  
for(int i = 0; i < messageList.Count; i++)
{
    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime());
} 
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/     
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": {
                    "message": "Info logs",
                    "type": "INFO",
                    "logTime": "2012-05-09T12:38:17.437Z",
                    "module": "testmod"
                }
            }
        }
    }
}
public Log Debug(String msg, String module)

Logs the debug message

Parameters:

msg - Message to be logged
module - Module name for which the message is getting logged

Returns:

Log object containing logged message

Response: Log Object

For more details click Exception
String msg = "Debug logs";
String module =	"testmod";	

Log log = logService.Debug(message,module);   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList();  
for(int i = 0; i < messageList.Count; i++)
{
    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime());
} 
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/     
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": {
                    "message": "Debug logs",
                    "type": "DEBUG",
                    "logTime": "2012-05-09T12:39:33.237Z",
                    "module": "testmod"
                }
            }
        }
    }
}
public Log Fatal(String msg, String module)

Logs the fatal message

Parameters:

msg - Message to be logged
module - Module name for which the message is getting logged

Returns:

Log object containing logged message

Response: Log Object

For more details click Exception
String msg = "Fatal logs";
String module =	"testmod";	

Log log = logService.Fatal(message,module);   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList();  
for(int i = 0; i < messageList.Count; i++)
{
    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime());
} 
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/     
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": {
                    "message": "Fatal logs",
                    "type": "FATAL",
                    "logTime": "2012-05-09T12:40:49.678Z",
                    "module": "testmod"
                }
            }
        }
    }
}
public Log Error(String msg, String module)

Logs the error message

Parameters:

msg - Message to be logged
module - Module name for which the message is getting logged.

Returns:

Log object containing logged message

Response: Log Object

For more details click Exception
String msg = "Error logs";
String module =	"testmod";	

Log log = logService.Error(message,module);   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList();  
for(int i = 0; i < messageList.Count; i++)
{
    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime()); 
} 
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/       
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": {
                    "message": "Error logs",
                    "type": "ERROR",
                    "logTime": "2012-05-09T12:45:47.435Z",
                    "module": "testmod"
                }
            }
        }
    }
}
public Log FetchLogsByModule(String moduleName)

Fetch the log messages based on the Module

Parameters:

moduleName - Module name for which the messages has to be fetched

Returns:

Log object containing fetched messages

Response: Log Object

Exception:

The method throws the following exception with the error code.
/* 
2700 - NOT FOUND -Logs for the module '<module>' does not exist.
*/ 	        
For more details click Exception
String moduleName =	"testmod";	

Log log = logService.FetchLogsByModule(moduleName);   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList();  
for(int i = 0; i < messageList.Count; i++)

    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime()); 
} 
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/     
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": [
                    {
                        "message": "Info logs",
                        "logTime": "2012-05-09T12:37:57.000Z",
                        "module": "testmod",
                        "type": "INFO"
                    },
                    {
                        "message": "Info logs",
                        "logTime": "2012-05-09T12:38:17.000Z",
                        "module": "testmod",
                        "type": "INFO"
                    },
                    {
                        "message": "Debug logs",
                        "logTime": "2012-05-09T12:39:33.000Z",
                        "module": "testmod",
                        "type": "DEBUG"
                    },
                    {
                        "message": "Fatal logs",
                        "logTime": "2012-05-09T12:40:49.000Z",
                        "module": "testmod",
                        "type": "FATAL"
                    },
                    {
                        "message": "Error logs",
                        "logTime": "2012-05-09T12:45:47.000Z",
                        "module": "testmod",
                        "type": "ERROR"
                    }
                ]
            }
        }
    }
}
public App42Response FetchLogsCountByModule(String moduleName)

Fetch the count of log messages based on the Module

Parameters:

moduleName - Module name for which the count of messages has to be fetched

Returns:

App42Response object containing count of fetched messages

Response: App42Response Object

For more details click Exception
String moduleName =	"testmod";

App42Response response = logService.FetchLogsCountByModule(moduleName);   /* returns the App42Response object. */ 
Boolean success = response.IsResponseSuccess();  
int totalRecords = response.GetTotalRecords();
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/        
{
    "app42": {
        "response": {
            "success": true,
            "totalRecords": 3
        }
    }
}
public Log FetchLogsByModule(String moduleName,int max, int offset)

Fetch the log messages based on the Module by paging.

Parameters:

moduleName - Module name for which the messages has to be fetched
max - Maximum number of records to be fetched
offset - From where the records are to be fetched

Returns:

Log object containing fetched messages

Response: Log Object

Exception:

The method throws the following exception with the error code.
/* 
2700 - NOT FOUND - Logs for the Module {module} does not Exists 
2704 - NOT FOUND - The number of logs for the module '<module>' are less than the specified offset : <offset>.
*/ 	        
For more details click Exception
String moduleName = "testmod";
int max = 1;
int offset = 0;

Log log = logService.FetchLogsByModule(moduleName,max,offset);   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList();  
for(int i = 0; i < messageList.Count; i++)
{
    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime()); 
} 
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/        
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": {
                    "message": "debug logs",
                    "logTime": "2012-06-02T14:08:26.000Z",
                    "module": "testmod",
                    "type": "DEBUG"
                }
            }
        }
    }
}
public Log FetchLogsByModuleAndText(String moduleName, String text)

Fetch log messages based on the Module and Message Text.

Parameters:

moduleName - Module name for which the messages has to be fetched
text - The log message on which logs have to be searched

Returns:

Log object containing fetched messages

Response: Log Object

Exception:

The method throws the following exception with the error code.
/* 
2703 - NOT FOUND - Logs for the module '<module>' with text '<text>' does not exist.
*/ 		       
For more details click Exception
String moduleName = "testmod";
String text = "Info logs";	

Log log = logService.FetchLogsByModuleAndText(moduleName, text);   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList();
for(int i = 0; i < messageList.Count; i++)
{
    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime());
}   
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/       
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": [
                    {
                        "message": "Info logs",
                        "logTime": "2012-05-09T12:37:57.000Z",
                        "module": "testmod",
                        "type": "INFO"
                    },
                    {
                        "message": "Info logs",
                        "logTime": "2012-05-09T12:38:17.000Z",
                        "module": "testmod",
                        "type": "INFO"
                    }
                ]
            }
        }
    }
}
public App42Response FetchLogsCountByModuleAndText(String moduleName, String text)

Fetch count of log messages based on the Module and Message Text

Parameters:

moduleName - Module name for which the count of messages has to be fetched
text - The log message on which count of logs have to be searched

Returns:

App42Response object containing count of fetched messages

Response: App42Response Object

For more details click Exception
String moduleName = "testmod";
String text = "debug logs";

App42Response response = logService.FetchLogsCountByModuleAndText(moduleName,text);   /* returns the App42Response object. */ 
Boolean success = response.IsResponseSuccess(); 
int totalRecords = response.GetTotalRecords(); 
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/      
{
    "app42": {
        "response": {
            "success": true,
            "totalRecords": 3
        }
    }
}
public Log FetchLogsByModuleAndText(String moduleName, String text, int max, int offset)

Fetch log messages based on the Module and Message Text by paging.

Parameters:

moduleName - Module name for which the messages has to be fetched
text - The log message on which logs have to be searched
max - Maximum number of records to be fetched
offset - From where the records are to be fetched

Returns:

Log object containing fetched messages

Response: Log Object

Exception:

The method throws the following exception with the error code.
/* 
2707 - NOT FOUND - The number of logs for the module '<module>' with text '<text>' are less than the specified offset : <offset>.
*/ 		       
For more details click Exception
String moduleName = "testmod";
String text = "debug logs";
int max = 1;
int offset = 0;

Log log = logService.FetchLogsByModuleAndText(moduleName,text,max,offset);   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList();  
for(int i = 0; i < messageList.Count; i++)
{
    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime());  
} 
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/    
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": {
                    "message": "debug logs",
                    "logTime": "2012-06-02T14:08:22.000Z",
                    "module": "testmod",
                    "type": "DEBUG"
                }
            }
        }
    }
}
public Log FetchLogsByInfo()

Fetch log messages based on Info Level.

Parameters:

N/A

Returns:

Log object containing fetched info messages

Response: Log Object

Exception:

The method throws the following exception with the error code.
/* 
2701 - NOT FOUND - Logs for the type '<type>' does not exist.
*/ 		        
For more details click Exception
Log log = logService.FetchLogsByInfo();   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList(); 
for(int i = 0; i < messageList.Count; i++)
{
    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime());
}  
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/      
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": [
                    {
                        "message": "Info logs",
                        "logTime": "2012-05-09T12:37:57.000Z",
                        "module": "testmod",
                        "type": "INFO"
                    },
                    {
                        "message": "Info logs",
                        "logTime": "2012-05-09T12:38:17.000Z",
                        "module": "testmod",
                        "type": "INFO"
                    }
                ]
            }
        }
    }
}
public App42Response FetchLogsCountByInfo()

Fetch count of log messages based on Info Level

Parameters:

N/A

Returns:

App42Response object containing count of fetched info messages

Response: App42Response Object

For more details click Exception
App42Response response = logService.FetchLogsCountByInfo();   /* returns the App42Response object. */ 
Boolean success = response.IsResponseSuccess();
int totalRecords = response.GetTotalRecords();
String jsonResponse = response.ToString(); /* returns the response in JSON format. (as shown below)*/    
{
    "app42": {
        "response": {
            "success": true,
            "totalRecords":3
        }
    }
}
public Log FetchLogsByInfo(int max, int offset)

Fetch log messages based on Info Level by paging.

Parameters:

max - Maximum number of records to be fetched
offset - From where the records are to be fetched

Returns:

Log object containing fetched info messages

Response: Log Object

Exception:

The method throws the following exception with the error code.
/* 
2705 - NOT FOUND - The number of logs for the module '<module>' are less thanThe number of logs for the type '<type>' are less than the specified offset : <offset>.he specified offset : <offset>.
*/ 		        
For more details click Exception
int max = 1;
int offset = 0;

Log log = logService.FetchLogsByInfo(max,offset);   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList();  
for(int i = 0; i < messageList.Count; i++)
{
    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime()); 
} 
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/     
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": {
                    "message": "info logs",
                    "logTime": "2012-06-02T14:14:54.000Z",
                    "module": "testmod",
                    "type": "INFO"
                }
            }
        }
    }
}
public Log FetchLogsByDebug()

Fetch log messages based on Debug Level.

Parameters:

N/A

Returns:

Log object containing fetched debug messages

Response: Log Object

Exception:

The method throws the following exception with the error code.
/* 
2701 - NOT FOUND - Logs for the type '<type>' does not exist.
*/ 		        
For more details click Exception
Log log = logService.FetchLogsByDebug();   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList();  
for(int i = 0; i < messageList.Count; i++)
{
    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime());  
} 
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/   
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": {
                    "message": "Debug logs",
                    "logTime": "2012-05-09T12:39:33.000Z",
                    "module": "testmod",
                    "type": "DEBUG"
                }
            }
        }
    }
}
public App42Response FetchLogsCountByDebug()

Fetch count of log messages based on Debug Level

Parameters:

N/A

Returns:

App42Response object containing count of fetched debug messages

Response: App42Response Object

For more details click Exception
App42Response response = logService.FetchLogsCountByDebug();   /* returns the App42Response object. */ 
Boolean success = response.IsResponseSuccess(); 
int totalRecords = response.GetTotalRecords();   
String jsonResponse = response.ToString(); /* returns the response in JSON format. (as shown below)*/      
{
    "app42": {
        "response": {
            "success": true,
            "totalRecords": 3
        }
    }
}
public Log FetchLogsByDebug(int max, int offset)

Fetch log messages based on Debug Level by paging.

Parameters:

max - Maximum number of records to be fetched
offset - From where the records are to be fetched

Returns:

Log object containing fetched debug messages

Response: Log Object

Exception:

The method throws the following exception with the error code.
/* 
2705 - NOT FOUND - The number of logs for the module '<module>' are less thanThe number of logs for the type '<type>' are less than the specified offset : <offset>.he specified offset : <offset>.
*/ 		       
For more details click Exception
int max = 1;
int offset = 0;

Log log = logService.FetchLogsByDebug(max,offset);   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList();  
for(int i = 0; i < messageList.Count; i++)
{
    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime());    
} 
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/      
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": {
                    "message": "debug logs",
                    "logTime": "2012-06-02T14:08:22.000Z",
                    "module": "testmod",
                    "type": "DEBUG"
                }
            }
        }
    }
}
public Log FetchLogsByError()

Fetch log messages based on Error Level.

Parameters:

N/A

Returns:

Log object containing fetched error messages

Response: Log Object

Log object containing fetched error messages

Response: Log Object

Exception:

The method throws the following exception with the error code.
/* 
2701 - NOT FOUND - Logs for the type '<type>' does not exist.
*/ 		       
For more details click Exception
Log log = logService.FetchLogsByError();   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList();  
for(int i = 0; i < messageList.Count; i++)
{
    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime());    
} 
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/       
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": {
                    "message": "Error logs",
                    "logTime": "2012-05-09T12:45:47.000Z",
                    "module": "testmod",
                    "type": "ERROR"
                }
            }
        }
    }
}
public App42Response FetchLogsCountByError()

Fetch count of log messages based on Error Level

Parameters:

N/A

Returns:

App42Response object containing count of fetched error messages

Response: App42Response Object

For more details click Exception
App42Response response = logService.FetchLogsCountByError();   /* returns the App42Response object. */ 
Boolean success = response.IsResponseSuccess();  
int totalRecords = response.GetTotalRecords();
String jsonResponse = response.ToString(); /* returns the response in JSON format. (as shown below)*/     
{
    "app42": {
        "response": {
            "success": true,
            "totalRecords": 3
        }
    }
}
public Log FetchLogsByError()

Fetch log messages based on Error Level by paging.

Parameters:

max - Maximum number of records to be fetched
offset - From where the records are to be fetched

Returns:

Log object containing fetched error messages

Response: Log Object

Exception:

The method throws the following exception with the error code.
/* 
2705 - NOT FOUND - The number of logs for the module '<module>' are less thanThe number of logs for the type '<type>' are less than the specified offset : <offset>.he specified offset : <offset>.
*/ 		       
For more details click Exception
int max = 1;
int offset = 0;

Log log = logService.FetchLogsByError(max,offset);   /* returns the Log object. */ 
for(int i = 0; i < messageList.Count; i++)
{
    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime()); 
} 
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/     
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": {
                    "message": "error logs",
                    "logTime": "2012-06-02T14:17:14.000Z",
                    "module": "testmod",
                    "type": "ERROR"
                }
            }
        }
    }
}
public Log FetchLogsByFatal()

Fetch log messages based on Fatal Level.

Parameters:

N/A

Returns:

Log object containing fetched Fatal messages

Response: Log Object

Log object containing fetched Fatal messages

Response: Log Object

Exception:

The method throws the following exception with the error code.
/* 
2701 - NOT FOUND - Logs for the type '<type>' does not exist.
*/ 		       
For more details click Exception
Log log = logService.FetchLogsByFatal();   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList();  
for(int i = 0; i < messageList.Count; i++)
{
    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime());  
} 
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/      
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": {
                    "message": "Fatal logs",
                    "logTime": "2012-05-09T12:40:49.000Z",
                    "module": "testmod",
                    "type": "FATAL"
                }
            }
        }
    }
}
public App42Response FetchLogsCountByFatal()

Fetch count of log messages based on Fatal Level

Parameters:

N/A

Returns:

App42Response object containing count of fetched fatal messages

Response: App42Response Object

For more details click Exception
App42Response response = logService.FetchLogsCountByFatal();   /* returns the App42Response object. */ 
Boolean success = response.IsResponseSuccess(); 
int totalRecords = response.GetTotalRecords(); 
String jsonResponse = response.ToString(); /* returns the response in JSON format. (as shown below)*/     
{
    "app42": {
        "response": {
            "success": true,
            "totalRecords": 3
        }
    }
}			
public Log FetchLogsByFatal(int max, int offset)

Fetch log messages based on Fatal Level by paging.

Parameters:

max - Maximum number of records to be fetched
offset - From where the records are to be fetched

Returns:

Log object containing fetched Fatal messages

Response: Log Object

Exception:

The method throws the following exception with the error code.
/* 
2705 - NOT FOUND - The number of logs for the module '<module>' are less thanThe number of logs for the type '<type>' are less than the specified offset : <offset>.he specified offset : <offset>.
*/ 		   
For more details click Exception
int max = 1;
int offset = 0;

Log log = logService.FetchLogsByFatal(max,offset);   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList();  
for(int i = 0; i < messageList.Count; i++)
{
    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime());   
} 
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/      
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": {
                    "message": "fatal logs",
                    "logTime": "2012-06-02T14:18:00.000Z",
                    "module": "testmod",
                    "type": "FATAL"
                }
            }
        }
    }
}			
public Log FetchLogByDateRange(DateTime startDate, DateTime endDate)

Fetch log messages based on Date range.

Parameters:

startDate - Start date from which the log messages have to be fetched.
endDate - End date upto which the log messages have to be fetched

Returns:

Log object containing fetched messages

Response: Log Object

Exception:

The method throws the following exception with the error code.
/* 
2702 - Not Found - Logs betweem startDate '<startDate>' and endDate '<endDate>' does not exist.
*/ 		
For more details click Exception
DateTime startTime = DateTime.Today;
DateTime endTime = DateTime.Now;

Log log = logService.FetchLogsByDateRange(startDate, endDate);   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList();  
for(int i = 0; i < messageList.Count; i++)
{
    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime());   
} 
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/        
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": [
                    {
                        "message": "Fatal logs",
                        "logTime": "2012-05-13T05:42:37.000Z",
                        "module": "testmod",
                        "type": "FATAL"
                    },
                    {
                        "message": "Hello",
                        "logTime": "2012-05-13T05:43:05.000Z",
                        "module": "Module",
                        "type": "DEBUG"
                    },
                    {
                        "message": "Hello",
                        "logTime": "2012-05-13T05:43:48.000Z",
                        "module": "Module",
                        "type": "DEBUG"
                    }
                ]
            }
        }
    }
}
public App42Response FetchLogCountByDateRange(DateTime startDate, DateTime endDate)

Fetch count of log messages based on Date range

Parameters:

startDate - Start date from which the count of log messages have to be fetched
endDate - End date upto which the count of log messages have to be fetched

Returns:

App42Response object containing count of fetched messages

Response: App42Response Object

For more details click Exception
DateTime startTime = DateTime.Today;
DateTime endTime = DateTime.Now;

App42Response response = logService.FetchLogsCountByDateRange(startDate,endDate);   /* returns the App42Response object. */ 
Boolean success = response.IsResponseSuccess();
int totalRecords = response.GetTotalRecords();
String jsonResponse = response.ToString(); /* returns the response in JSON format. (as shown below)*/       
{
    "app42": {
        "response": {
            "success": true,
            "totalRecords": 3
        }
    }
}	
public Log FetchLogByDateRange(DateTime startDate, DateTime endDate, int max, int offset)

Fetch log messages based on Date range by paging.

Parameters:

startDate - Start date from which the log messages have to be fetched.
endDate - End date upto which the log messages have to be fetched
max - Maximum number of records to be fetched
offset - From where the records are to be fetched

Returns:

Log object containing fetched messages

Response: Log Object

Exception:

The method throws the following exception with the error code.
/* 
2706 - NOT FOUND - The number of logs betweem startDate '<startDate>' and endDate '<endDate>' are less than the specified offset : <offset>.
*/ 	     
For more details click Exception
s
DateTime startTime = DateTime.Today;
DateTime endTime = DateTime.Now;
int max = 1;
int offset = 0;

Log log = logService.FetchLogsByDateRange(startDate,endDate,max,offset);   /* returns the Log object. */ 
IList<Log.Message> messageList =  log.GetMessageList();  
for(int i = 0; i < messageList.Count; i++)
{
    Console.WriteLine("msg is " + messageList[0].GetMessage());
	Console.WriteLine("module is " + messageList[0].GetModule());
	Console.WriteLine("type is " + messageList[0].GetType());
	Console.WriteLine("logTime is " + messageList[0].GetLogTime());  
} 
String jsonResponse = log.ToString(); /* returns the response in JSON format. (as shown below)*/            
{
    "app42": {
        "response": {
            "success": true,
            "logs": {
                "log": {
                    "message": "info logs",
                    "logTime": "2012-06-05T10:59:27.000Z",
                    "module": "testmod",
                    "type": "INFO"
                }
            }
        }
    }
}