001/*
002// This software is subject to the terms of the Eclipse Public License v1.0
003// Agreement, available at the following URL:
004// http://www.eclipse.org/legal/epl-v10.html.
005// You must accept the terms of that agreement to use this software.
006//
007// Copyright (C) 2005-2005 Julian Hyde
008// Copyright (C) 2005-2009 Pentaho and others
009// All Rights Reserved.
010*/
011package mondrian.recorder;
012
013import org.apache.log4j.Logger;
014
015/**
016 * Implementation of {@link MessageRecorder} that writes to a
017 * {@link Logger log4j logger}.
018 *
019 * @author Richard M. Emberson
020 */
021public class LoggerRecorder extends AbstractRecorder {
022    private final Logger logger;
023
024    public LoggerRecorder(final Logger logger) {
025        this.logger = logger;
026    }
027
028    protected void recordMessage(
029        final String msg,
030        final Object info,
031        final MsgType msgType)
032    {
033        String context = getContext();
034        logMessage(context, msg, msgType, logger);
035    }
036}
037
038// End LoggerRecorder.java