App42 Cloud API

Ruby Cloud SDK

Log

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.

api = App42::ServiceAPI.new("<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 = 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 Log 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.

message = "Info logs";
module = "testmod";
						
log = logService.info(message, appModule);   /* returns the Log object. */
messageList = Array.new();
messageList =  log.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* returns the response in JSON format. */

The functions availab+le 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".

moduleName = "testmod";
							
begin
  log = logService.fetchLogsByModule(moduleName);
rescue App42Exception => ex
  appErrorCode = ex.app_error_code;
  httpErrorCode = ex.http_error_code;
  if(appErrorCode == 2700)
    #Handle here for Not Found (Logs for the module '<module>' does not exist.)

  elsif(appErrorCode == 1401)
    #handle here for Client is not authorized

  else(appErrorCode == 1500)
    #handle here for Internal Server Error
  end

  jsonText = ex.getMessage(); /* returns the Exception text in JSON format. (as shown below)*/
end
	{
		"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 type '<type>' are less than the 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.

def info( msg, appModule)

Logs the info message

Parameters:

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

Returns:

Log object containing logged message

Response: Log Object

msg = "Info logs";
appModule = "testmod";	
					
log = logService.info(msg, appModule);   /* returns the Log object. */
messageList = Array.new();
messageList = log .messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                }
            }
        }
    }
}
def debug( msg,appModule)

Logs the debug message

Parameters:

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

Returns:

Log object containing logged message

Response: Log Object

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

log = logService.debug(msg, appModule);   /* returns the Log object. */
messageList = Array.new();
messageList = log.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                }
            }
        }
    }
}
def fatal( msg, appModule)

Logs the fatal message

Parameters:

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

Returns:

Log object containing logged message

Response: Log Object

For more details click Exception
msg = "Fatal logs";
module = "testmod";
						
log = logService.fatal(msg, appModule);   /* returns the Log object. */
messageList = Array.new();
messageList = log.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                }
            }
        }
    }
}
def error( msg, appModule)

Logs the error message

Parameters:

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

Returns:

Log object containing logged message

Response: Log Object

For more details click Exception
msg = "Error logs";
appModule =	"testmod";
						
log = logService.error(msg, appModule);   /* returns the Log object. */
messageList = Array.new()   ;
messageList = log.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                }
            }
        }
    }
}
def fetch_logs_by_module(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:

This method throws following exception.
/* 
2700 - NOT FOUND - Logs for the module '<module>' does not exist. 
*/
For more details click Exception
moduleName = "testmod";			
				
log = logService.fetch_logs_by_module(moduleName);   /* returns the Log object. */
messageList = Array.new();
messageList = message.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                    }
                ]
            }
        }
    }
}
def fetch_logs_count_by_module(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

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
moduleName = "testmod";
						
response = logService.fetch_logs_count_by_module(moduleName); /* returns the App42Response objects. */
success = response.isResponseSuccess();
totalRecords = response.totalRecords();
jsonResponse = response.to_s(); /* returns the response in JSON format. (as shown below)*/
{
    "app42": {
        "response": {
            "success": true,
            "totalRecords": 3
        }
    }
}
def fetch_logs_by_module_by_paging(moduleName, max, 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:

App42Response object containing count of 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.
2704 - NOT FOUND - The number of logs for the module '<module>' are less than the specified offset : <offset>. 
*/
For more details click Exception
moduleName = "testmod";
max = 1;
offset = 0;		
				
log = logService.fetch_logs_by_module_by_paging(moduleName,max,offset);   /* returns the Log object. */
messageList = Array.new();
messageList = message.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                }
            }
        }
    }
}
def fetch_logs_by_module_and_text(moduleName, 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
moduleName = "testmod";
text = "Info logs";

log = logService.fetch_logs_by_module_and_text(moduleName,text);   /* returns the Log object. */
messageList  = Array.new();
messageList = message.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                    }
                ]
            }
        }
    }
}
def fetch_logs_count_by_module_and_text(moduleName, 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

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
moduleName = "testmod";
text = "debug logs";
						
response = logService.fetch_logs_count_by_module_and_text(moduleName,text); /* returns the App42Response objects. */
success = response.isResponseSuccess();
totalRecords = response.totalRecords();
jsonResponse = response.to_s(); /* returns the response in JSON format. (as shown below)*/
{
    "app42": {
        "response": {
            "success": true,
            "totalRecords": 3
        }
    }
}
def fetch_logs_by_module_and_text_by_paging(moduleName, text, max, 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
moduleName = "testmod";
text = "debug logs";
max = 1;
offset = 0;
						
log = logService.fetch_logs_by_module_and_text_by_paging(moduleName,text,max,offset);  /* returns the Log object. */
messageList  = Array.new();
messageList = log.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                }
            }
        }
    }
}
def fetch_logs_by_info()

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 = logService.fetch_logs_by_info();  /* returns the Log object. */
messageList = Array.new();
messageList = log.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                    }
                ]
            }
        }
    }
}
def fetch_logs_count_by_info()

Fetch count of log messages based on Info Level

Parameters:

N/A

Returns:

App42Response object containing count of fetched info messages

Response: App42Response 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
response = logService.fetch_logs_count_by_info(); /* returns the App42Response objects. */
success = response.isResponseSuccess();
totalRecords = response.totalRecords();
jsonResponse = response.to_s(); /* returns the response in JSON format. (as shown below)*/
{
    "app42": {
        "response": {
            "success": true,
            "totalRecords":3
        }
    }
}
def fetch_logs_by_info_by_paging(max, 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 type '<type>' are less than the specified offset : <offset>.
*/
max = 1;
offset = 0;		
				
log = logService.fetch_logs_by_info_by_paging(max, offset);  /* returns the Log object. */
messageList = Array.new();
messageList = log.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                }
            }
        }
    }
}
def fetch_logs_by_debug()

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 = logService.fetch_logs_by_debug();  /* returns the Log object. */
messageList = Array.new();
messageList = log.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                }
            }
        }
    }
}
def fetch_logs_count_by_debug()

Fetch count of log messages based on Debug Level.

Parameters:

N/A

Returns:

App42Response object containing count of fetched debug messages

Response: App42Response 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
response = logService.fetch_logs_count_by_debug(); /* returns the App42Response objects. */
success = response.isResponseSuccess();
totalRecords = response.totalRecords();
jsonResponse = response.to_s(); /* returns the response in JSON format. (as shown below)*/
{
    "app42": {
        "response": {
            "success": true,
            "totalRecords": 3
        }
    }
}
def fetch_logs_by_debug_by_paging(max, 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 type '<type>' are less than the specified offset : <offset>.
*/
For more details click Exception
max = 1;
offset = 0;
						
log = logService.fetch_logs_by_debug_by_paging(max, offset);  /* returns the Log object. */
messageList = Array.new();
messageList = log.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                }
            }
        }
    }
}
def fetch_logs_by_error()

Fetch log messages based on Error Level.

Parameters:

N/A

Returns:

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 = logService.fetch_logs_by_error();  /* returns the Log object. */
messageList = Array.new();
messageList = log.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                }
            }
        }
    }
}
def fetch_logs_count_by_error()

Fetch count of log messages based on Error Level

Parameters:

N/A

Returns:

App42Response object containing count of 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
response = logService.fetch_logs_count_by_error(); /* returns the App42Response objects. */
success = response.isResponseSuccess();
totalRecords = response.totalRecords();
jsonResponse = response.to_s(); /* returns the response in JSON format. (as shown below)*/
{
    "app42": {
        "response": {
            "success": true,
            "totalRecords": 3
        }
    }
}
def fetch_logs_by_error_by_paging(max, offset)

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 type '<type>' are less than the specified offset : <offset>.
*/
For more details click Exception
max = 1;
int offset = 0;
						
log = logService.fetch_logs_by_error_by_paging(max, offset);  /* returns the Log object. */
messageList = Array.new();
messageList = log.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                }
            }
        }
    }
}
def fetch_logs_by_fatal()

Fetch log messages based on Fatal Level.

Parameters:

N/A

Returns:

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 = logService.fetch_logs_by_fatal();  /* returns the Log object. */
messageList = Array.new();
messageList = log.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                }
            }
        }
    }
}
def fetch_logs_count_by_fatal()

Fetch count of log messages based on Fatal Level

Parameters:

N/A

Returns:

App42Response object containing count of 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
response = logService.fetch_logs_count_by_fatal(); /* returns the App42Response objects. */
success = response.isResponseSuccess();
totalRecords = response.totalRecords();
jsonResponse = response.to_s(); /* returns the response in JSON format. (as shown below)*/
{
    "app42": {
        "response": {
            "success": true,
            "totalRecords": 3
        }
    }
}
def fetch_logs_by_fatal_by_paging(max, 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 type '<type>' are less than the specified offset : <offset>.
*/
For more details click Exception
max = 1;
offset = 0;	
					
log = logService.fetch_logs_by_fatal_by_paging(max,offset);  /* returns the Log object. */
messageList = Array.new();
messageList = log.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                }
            }
        }
    }
}
def fetch_log_by_date_range(startDate, 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
startDate = (Date.today - 7).to_s
endDate = Time.now.to_s	
					
log = logService.fetch_log_by_date_range(startDate,endDate);  /* returns the Log object. */
messageList = Array.new();
messageList = log.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "appModule is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                    }
                ]
            }
        }
    }
}
def fetch_log_count_by_date_range(startDate, 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

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
startDate = (Date.today - 7).to_s
endDate = Time.now.to_s	
						
response = logService.fetch_log_count_by_date_range(startDate,endDate); /* returns the App42Response objects. */
success = response.isResponseSuccess();
totalRecords = response.totalRecords();
jsonResponse = response.to_s(); /* returns the response in JSON format. (as shown below)*/
{
    "app42": {
        "response": {
            "success": true,
            "totalRecords": 3
        }
    }
}
def fetch_log_by_date_range_by_paging(startDate, endDate, max, 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
startDate = (Date.today - 7).to_s
endDate = Time.now.to_s	
max = 1;
offset = 0;	
					
log = logService.fetch_log_by_date_range_by_paging(startDate,endDate, max, offset);  /* returns the Log object. */
messageList  = Array.new();
messageList = log.messageList();
for message in messageList do
  puts "message is #{message.message}";
  puts "module is #{message.module}";
  puts "type is #{message.type}";
  puts "logTime is #{message.logTime}";
end
jsonResponse = log.to_s(); /* 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"
                }
            }
        }
    }
}