michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIConsoleListener; michael@0: interface nsIConsoleMessage; michael@0: michael@0: [scriptable, uuid(0eb81d20-c37e-42d4-82a8-ca9ae96bdf52)] michael@0: interface nsIConsoleService : nsISupports michael@0: { michael@0: void logMessage(in nsIConsoleMessage message); michael@0: michael@0: /** michael@0: * Convenience method for logging simple messages. michael@0: */ michael@0: void logStringMessage(in wstring message); michael@0: michael@0: /** michael@0: * Get an array of all the messages logged so far. If no messages michael@0: * are logged, this function will return a count of 0, but still michael@0: * will allocate one word for messages, so as to show up as a michael@0: * 0-length array when called from script. michael@0: */ michael@0: void getMessageArray([optional] out uint32_t count, michael@0: [retval, array, size_is(count)] out nsIConsoleMessage messages); michael@0: michael@0: /** michael@0: * To guard against stack overflows from listeners that could log michael@0: * messages (it's easy to do this inadvertently from listeners michael@0: * implemented in JavaScript), we don't call any listeners when michael@0: * another error is already being logged. michael@0: */ michael@0: void registerListener(in nsIConsoleListener listener); michael@0: michael@0: /** michael@0: * Each registered listener should also be unregistered. michael@0: */ michael@0: void unregisterListener(in nsIConsoleListener listener); michael@0: michael@0: /** michael@0: * Clear the message buffer (e.g. for privacy reasons). michael@0: */ michael@0: void reset(); michael@0: }; michael@0: michael@0: michael@0: %{ C++ michael@0: #define NS_CONSOLESERVICE_CID \ michael@0: { 0x7e3ff85c, 0x1dd2, 0x11b2, { 0x8d, 0x4b, 0xeb, 0x45, 0x2c, 0xb0, 0xff, 0x40 }} michael@0: michael@0: #define NS_CONSOLESERVICE_CONTRACTID "@mozilla.org/consoleservice;1" michael@0: %} michael@0: