gecko/services/sync/ILog4MozService.idl

138 lines
4.2 KiB
Plaintext

/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is log4moz
*
* The Initial Developer of the Original Code is
* Michael Johnston
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Dan Mills <thunder@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIFile;
[scriptable, uuid(eeb0adbc-afa3-4326-9a52-040ce4855e9d)]
interface ILogMessage : nsISupports
{
attribute AString loggerName;
attribute PRInt32 level;
attribute AString levelDesc;
attribute AString message;
attribute PRTime time;
};
[scriptable, uuid(ac7f40df-49e7-4270-86ec-9c905047e70e)]
interface IFormatter : nsISupports
{
AString format(in ILogMessage message);
};
[scriptable, uuid(abe56c32-79f4-465e-ac20-8e39d33cba0b)]
interface IAppender : nsISupports
{
attribute PRInt32 level;
void append(in ILogMessage message);
};
[scriptable, uuid(2c1a0f87-f544-479c-80e0-acd11ae52ebf)]
interface ILogger : nsISupports
{
/*
* Level constants
*/
const PRInt32 LEVEL_FATAL = 70;
const PRInt32 LEVEL_ERROR = 60;
const PRInt32 LEVEL_WARN = 50;
const PRInt32 LEVEL_INFO = 40;
const PRInt32 LEVEL_CONFIG = 30;
const PRInt32 LEVEL_DEBUG = 20;
const PRInt32 LEVEL_TRACE = 10;
const PRInt32 LEVEL_ALL = 0;
/*
* The assigned level for this logger. Applies also to descendant
* loggers unless overridden.
*/
attribute PRInt32 level;
/*
* Add an appender to this logger's list. Anything logged via this
* logger will be sent to the list of appenders (including its
* parent logger's appenders).
*/
void addAppender(in IAppender appender);
/*
* Log messages at various levels
*/
void fatal(in AString message);
void error(in AString message);
void warn(in AString message);
void info(in AString message);
void config(in AString message);
void debug(in AString message);
void trace(in AString message);
};
[scriptable, uuid(cbfb3abe-4ca9-498a-a692-581f8da52323)]
interface ILoggerRepository : nsISupports
{
};
[scriptable, uuid(a60e50d7-90b8-4a12-ad0c-79e6a1896978)]
interface ILog4MozService : nsISupports
{
/*
* The root logger. Appenders added to this logger will be
* inherited by all other loggers
*/
readonly attribute ILogger rootLogger;
/*
* Get a Logger object that can be used to print debug/info/error
* messages to various places.
*
* @param name
* The name of the logger. A new logger will be created
* with that name if it doesn't already exist.
* @returns The ILogger object that can be used to log messages.
*/
ILogger getLogger(in AString name);
IAppender newAppender(in AString kind, in IFormatter formatter);
IAppender newFileAppender(in AString kind, in nsIFile file,
in IFormatter formatter);
IFormatter newFormatter(in AString kind);
};