javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/Log.java
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 14 May 2010 15:47:24 +0300
changeset 23 98ccebc37403
parent 21 2a9601315dfc
permissions -rw-r--r--
Revision: v2.1.24 Kit: 201019

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/

package com.nokia.mj.impl.rt.midp;

import com.nokia.mj.impl.utils.Logger;

/**
 * A utility class for logging.
 */


public final class Log
{

    /** Logger component id */
    private static final int COMPONENT_ID = Logger.EJavaRuntime;

    public static final boolean mOn = false;

    /**
     * Writes info log message.
     * @param msg log message
     */
    public static void logI(String msg)
    {
        Logger.ILOG(COMPONENT_ID, Thread.currentThread().getName() + ": " +msg);
    }

    /**
     * Writes infoPrd log message.
     * @param msg log message
     */
    public static void logP(String msg)
    {
        Logger.PLOG(COMPONENT_ID, msg);
    }

    /**
     * Writes warning log message.
     * @param msg log message
     */
    public static void logW(String msg)
    {
        Logger.WLOG(COMPONENT_ID, msg);
    }

    /**
     * Writes warning log message.
     * @param msg log message
     * @param t Throwable to be logged
     */
    public static void logW(String msg, Throwable t)
    {
        if (t == null)
        {
            Logger.WLOG(COMPONENT_ID, msg);
        }
        else
        {
            Logger.WLOG(COMPONENT_ID, msg, t);
        }
    }

    /**
     * Writes error log message.
     * @param msg log message
     */
    public static void logE(String msg)
    {
        Logger.ELOG(COMPONENT_ID, msg);
    }

    /**
     * Writes error log message.
     * @param msg log message
     * @param t Throwable to be logged
     */
    public static void logE(String msg, Throwable t)
    {
        if (t == null)
        {
            Logger.ELOG(COMPONENT_ID, msg);
        }
        else
        {
            Logger.ELOG(COMPONENT_ID, msg, t);
        }
    }
}