/*
 * BEGIN FLOCK GPL
 *
 * Copyright Flock Inc. 2005-2009
 * http://flock.com
 *
 * This file may be used under the terms of the
 * GNU General Public License Version 2 or later (the "GPL"),
 * http://www.gnu.org/licenses/gpl.html
 *
 * 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.
 *
 * END FLOCK GPL
 */

#ifndef __flockLoggingWriters_h__
#define __flockLoggingWriters_h__

#include "flockILoggingObserver.h"

#include "nsCOMPtr.h"
#include "nsIObserver.h"
#include "nsIOutputStream.h"


class flockLoggingConsoleWriter : public flockILoggingObserver {
public:
  NS_DECL_ISUPPORTS
  NS_DECL_FLOCKILOGGINGOBSERVER

  flockLoggingConsoleWriter();

private:
  ~flockLoggingConsoleWriter();
};

class flockLoggingFileWriter : public flockILoggingObserver,
                               public nsIObserver {
public:
  NS_DECL_ISUPPORTS
  NS_DECL_FLOCKILOGGINGOBSERVER
  NS_DECL_NSIOBSERVER

  NS_HIDDEN_(nsresult) Init();

  flockLoggingFileWriter();

private:
  ~flockLoggingFileWriter();

  NS_HIDDEN_(nsresult) Setup();
  NS_HIDDEN_(nsresult) Shutdown();
  NS_HIDDEN_(nsresult) PrefsChanged(const char *aPref);

  NS_HIDDEN_(nsresult) InitFile();
  NS_HIDDEN_(nsresult) CloseFile();

  PRBool mInitialized;
  nsCOMPtr<nsIOutputStream> mLogStream;
};

#endif
