vg
tools for working with variation graphs
Classes | Namespaces | Functions
log.hpp File Reference
#include <string>
#include <iostream>

Classes

class  vg::cerrWrapper
 
class  vg::Logger
 

Namespaces

 vg
 
 vg::logging
 

Functions

cerrWrapper vg::logging::info (const std::string &context)
 
cerrWrapper vg::logging::warn (const std::string &context)
 
cerrWrapper vg::logging::error (const std::string &context)
 

Detailed Description

log.hpp: defines a basic logging system for vg. Shipped along with utility.hpp

There are three options here:

Errors/warnings are output to std::cerr as: error[<context>] message warning[<context>] message where "context" is a string like "vg inject"

The error/warning functions exist to have a standardized error/warning format across the vg subcommands. You don't have to use them elsewhere, but it's a good idea to have consistent formatting.

These functions return a cerrWrapper object that behaves like a stream. You can stream things to it with operator<<, and when the object goes out of scope, it will exit the program with a failure code (in the case of error) or do nothing (in the case of warn() and info()).

Logging functions may either be accessed via logging::info/warn/error, or via a Logger object that is initialized with a context string.