Logger Class Reference

Collaboration diagram for Logger:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void debug (String mesg)
void debug (String mesg, Throwable ex)
void error (String mesg)
void error (String mesg, Throwable ex)
void fatal (String mesg)
void fatal (String mesg, Throwable ex)
int getLevel ()
void info (String mesg)
void info (String mesg, Throwable ex)
boolean isDebugEnabled ()
boolean isInfoEnabled ()
void setLevel (int level)
void warn (String mesg)
void warn (String mesg, Throwable ex)

Static Public Member Functions

static synchronized Logger getLogger (String name)
static synchronized Logger getLogger (String name, int level)

Static Public Attributes

static final int LEVEL_DEBUG = 0
static final int LEVEL_ERROR = 3
static final int LEVEL_FATAL = 4
static final int LEVEL_INFO = 1
static final int LEVEL_WARN = 2

Protected Member Functions

 Logger (String name)
 Logger (String name, int level)

Private Member Functions

void log (String mesg, Throwable ex)

Private Attributes

boolean initialized = false
int level
String name

Static Private Attributes

static Map< String, Loggerloggers


Detailed Description

This is a generic logger class for use in logging.

This can easily be swapped out for any other logging package in the main code. For now, this is just a quick and dirty logger which will allow you to specify log levels, but only wraps system.out.println.

Author:
Greg Whalin <greg@meetup.com>
Version:
1.5

Constructor & Destructor Documentation

Logger ( String  name,
int  level 
) [protected]

Logger ( String  name  )  [protected]


Member Function Documentation

void debug ( String  mesg  ) 

void debug ( String  mesg,
Throwable  ex 
)

logs a debug mesg

Parameters:
mesg 
ex 

void error ( String  mesg  ) 

void error ( String  mesg,
Throwable  ex 
)

logs error mesg

Parameters:
mesg 
ex 

void fatal ( String  mesg  ) 

void fatal ( String  mesg,
Throwable  ex 
)

logs fatal mesg

Parameters:
mesg 
ex 

int getLevel (  ) 

static synchronized Logger getLogger ( String  name  )  [static]

Gets a Logger obj for given name and sets default level.

Parameters:
name 
Returns:

static synchronized Logger getLogger ( String  name,
int  level 
) [static]

Gets a Logger obj for given name and level.

Parameters:
name 
level 
Returns:

void info ( String  mesg  ) 

void info ( String  mesg,
Throwable  ex 
)

logs info mesg

Parameters:
mesg 
ex 

boolean isDebugEnabled (  ) 

boolean isInfoEnabled (  ) 

void log ( String  mesg,
Throwable  ex 
) [private]

logs mesg to std out and prints stack trace if exception passed in

Parameters:
mesg 
ex 

void setLevel ( int  level  ) 

void warn ( String  mesg  ) 

void warn ( String  mesg,
Throwable  ex 
)

logs warn mesg

Parameters:
mesg 
ex 


Member Data Documentation

boolean initialized = false [private]

int level [private]

final int LEVEL_DEBUG = 0 [static]

final int LEVEL_ERROR = 3 [static]

final int LEVEL_FATAL = 4 [static]

final int LEVEL_INFO = 1 [static]

final int LEVEL_WARN = 2 [static]

Map<String,Logger> loggers [static, private]

Initial value:

                new HashMap<String,Logger>()

String name [private]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:42:30 2012 for Project Wonder by  doxygen 1.5.8