Bug 1060171 - Part 1: Add log levels to nsIConsoleMessage. r=froydnj

This commit is contained in:
Eric Rahm 2014-09-22 15:32:21 -07:00
parent c3faf6e570
commit 83245fc00d
4 changed files with 29 additions and 2 deletions

View File

@ -11,7 +11,7 @@
#include "nsISupports.idl"
#include "nsIConsoleMessage.idl"
[scriptable, uuid(cac9d8e8-0d53-4fa8-9903-bb367e4fa1fe)]
[scriptable, uuid(d6a8dae2-367f-4939-a843-11e0c48e240c)]
interface nsIScriptError : nsIConsoleMessage
{
/** pseudo-flag for default case */

View File

@ -52,6 +52,15 @@ nsScriptError::GetMessageMoz(char16_t **result) {
return NS_OK;
}
NS_IMETHODIMP
nsScriptError::GetLogLevel(uint32_t* aLogLevel)
{
*aLogLevel = mFlags & (uint32_t)nsIScriptError::errorFlag ?
nsIConsoleMessage::error : nsIConsoleMessage::warn;
return NS_OK;
}
// nsIScriptError methods
NS_IMETHODIMP
nsScriptError::GetErrorMessage(nsAString& aResult) {

View File

@ -33,6 +33,13 @@ nsConsoleMessage::GetMessageMoz(char16_t** aResult)
return NS_OK;
}
NS_IMETHODIMP
nsConsoleMessage::GetLogLevel(uint32_t* aLogLevel)
{
*aLogLevel = nsConsoleMessage::info;
return NS_OK;
}
NS_IMETHODIMP
nsConsoleMessage::GetTimeStamp(int64_t* aTimeStamp)
{

View File

@ -10,9 +10,20 @@
* provide an object that can be qi'ed to provide more specific
* message information.
*/
[scriptable, uuid(c14c151b-5ea4-47ed-8e85-d392cdd3e154)]
[scriptable, uuid(3aba9617-10e2-4839-83ae-2e6fc4df428b)]
interface nsIConsoleMessage : nsISupports
{
/** Log level constants. */
const uint32_t debug = 0;
const uint32_t info = 1;
const uint32_t warn = 2;
const uint32_t error = 3;
/**
* The log level of this message.
*/
readonly attribute uint32_t logLevel;
/**
* The time (in milliseconds from the Epoch) that the message instance
* was initialised.