xyginext  0.2.0
Second generation of xygine game creation framework
Public Types | Static Public Member Functions | Friends | List of all members
xy::Logger Class Referencefinal

Class to allowing messages to be logged to a combination of one or more destinations such as the console, log file or output window in Visual Studio. More...

#include <Log.hpp>

Public Types

enum  Output { Console, File, All }
 
enum  Type { Info, Warning, Error }
 

Static Public Member Functions

static std::ostream & log (Type=Type::Info, Output=Output::Console)
 Outputs to the log via the stream operator << Simplified output interface wo allow logging similar to cout or cerr. More...
 
static void log (const std::string &message, Type type=Type::Info, Output output=Output::Console)
 Logs a message to a given destination. More...
 

Friends

class xy::Detail::LogBuf
 

Detailed Description

Class to allowing messages to be logged to a combination of one or more destinations such as the console, log file or output window in Visual Studio.

Member Function Documentation

◆ log() [1/2]

static void xy::Logger::log ( const std::string &  message,
Type  type = Type::Info,
Output  output = Output::Console 
)
static

Logs a message to a given destination.

Parameters
messageMessage to log
typeWhether this message gets tagged as information, a warning or an error
outputDestination for the message. Can be the console via cout, a log file on disk, or both

◆ log() [2/2]

static std::ostream& xy::Logger::log ( Type  = Type::Info,
Output  = Output::Console 
)
static

Outputs to the log via the stream operator << Simplified output interface wo allow logging similar to cout or cerr.

Parameters
typeType of output. Defaults to Info
outputOutput destination. Defaults to Console. Example:
Logger::log() << "Hello\n";
Logger::log(Logger::Type::Error) << "something is wrong!" << std::endl;
xy::Logger::log
static std::ostream & log(Type=Type::Info, Output=Output::Console)
Outputs to the log via the stream operator << Simplified output interface wo allow logging similar to...