修复部分问题
This commit is contained in:
@@ -11,6 +11,8 @@ namespace ylib
|
||||
int64 random(int64 min, int64 max);
|
||||
//取运行目录
|
||||
std::string current_dir();
|
||||
//取EXE目录
|
||||
std::string application_dir();
|
||||
//取运行全路径
|
||||
std::string current_filepath();
|
||||
//取临时目录
|
||||
|
||||
@@ -16,8 +16,9 @@ If you have any questions, please contact us: 1585346868@qq.com Or visit our web
|
||||
*/
|
||||
|
||||
#include "base/environment.h"
|
||||
#include "util/system.h"
|
||||
namespace ylib
|
||||
{
|
||||
extern ylib::environment *env = new ylib::environment();
|
||||
extern ylib::log4 *log = new ylib::log4("./log/log.log");
|
||||
extern ylib::log4* log = nullptr;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ ylib::log4::log4(const std::string& filepath)
|
||||
APPENDER_CONSOLE->setLayout(std::unique_ptr<log4cplus::Layout>(new log4cplus::PatternLayout("%D{%Y-%m-%d %H:%M:%S.%q} [%-5p] [%c] - %m %n")));
|
||||
#else
|
||||
m_appender = new ylib::file_io;
|
||||
((ylib::file_io*)m_appender)->open(filepath);
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -78,8 +79,12 @@ inline void append_log(const char* name,const std::string& value)
|
||||
inline void append_log(void* appender, const std::string& type, const std::string& name, const std::string& value)
|
||||
{
|
||||
auto file = (ylib::file_io*)appender;
|
||||
std::string content = "[" + time::now_time() + "][" + name + "][" + type + "]: " + value;
|
||||
file->appead(content.c_str(),content.length());
|
||||
if (file->is_open())
|
||||
{
|
||||
std::string content = "[" + time::now_time() + "][" + name + "][" + type + "]: " + value;
|
||||
file->appead(content.c_str(), content.length());
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
ylib::log4& ylib::log4::warn(const std::string& value,const std::string& name)
|
||||
|
||||
@@ -167,6 +167,7 @@ bool ylib::file_io::read(int64 size, buffer &data)
|
||||
|
||||
void ylib::file_io::jump(int64 offset, std::ios_base::seekdir way)
|
||||
{
|
||||
|
||||
// 清楚所有错误状态
|
||||
m_stream->clear();
|
||||
// 根据提供的方向参数way来确定如何应用偏移量offset
|
||||
|
||||
Reference in New Issue
Block a user