mlog, ready to emit on sourceforge.net

来源:互联网 发布:水深测量数据检查 编辑:程序博客网 时间:2024/04/28 00:09

费了牛劲,写了N多的English,总算提交了新项目mlog。至于会不会被Reject,不是我目前应该考虑的事情。

这种英文恐怕是非常糟糕吧,不知道 sourceforge.net  的工作人员能不能看懂。“汗”一个先!

mlog将是基于 Apache Software Licence 2.0 的开源项目。

 

Descriptions:

    mlog is a logging implementation, which is configuration based, portable, extendable, and simple to uses. It supports "logging-levels", "logging-catalogs" and "multiple output-targets". mlog is developments by liigo using C++ programing language.

    mlog uses an optional config file, that just like java's *.properties file or windows' *.ini file. While mlog initializtion, it will searches and loads the config file, which maybe named "mlog-setting.txt" or "mlog-setting", in the current path. If not found, mlog will uses the default settings. In a common purpose, you do not even needs a config file.

    mlog supports "logging-levels": trace, debug, info, warning, error, fatal, print. Every logging message has its own logging-level. By editting the config file, one or more or all logging-levels can be selected to output to the "logging-targets".

    mlog supports "logging-catalogs", which is identified by a string. By editting the config file, users can determines which logging-catalogs(one or more, or none) can be output. The default logging-catalog is used by default.

    mlog support "output-targets", which is the targets where the logging messages will be outputed to. At present, "console" and "file" is implemented, however, much more output-targets such as "email" or "database" can be easily extended.

    mlog provides a sententious API. There is only one public class "MLog" with a few methods such as: trace(const char* szFormat, ...), debug(const char* szFormat, ...), info(const char* szFormat, ...), warning(const char* szFormat, ...), error(const char* szFormat, ...), fatal(const char* szFormat, ...), and print(const char* szFormat, ...), all these methods are "printf()" like, which is very familiar to C/C++ developers.

 

Uasages:

  First, #include "mlog.h", and then,

  MLog* log = MLog::GetLog();
  log->trace("a trace message");
  log->debug("a debug message, %d, %s, %f", 123, "liigo", 3.14159);
  log->warning("a waring message");
  log->error("an error message");
  log->fatal("a fatal error message");
  log->print("print a message"); 
 
  or:

  mlog->trace("a trace message");
  mlog->debug("a debug message, %d, %s, %f", 123, "liigo.com", 3.14159);
  mlog->warning("a waring message");
  mlog->error("an error message");
  mlog->fatal("a fatal error message");
  mlog->print("print a message"); 

  where, the "mlog" is a C++ macro (#define mlog MLog::GetLog()), which equals to MLog::GetLog().

  Which logging messages are outputed, and where the messages are outputed is depends upon the settings of the config file. By default, the messages which logging-level is greater than or equals to "warning" will be outputed to the console window.

原创粉丝点击