mirror of
https://github.com/joyieldInc/predixy.git
synced 2025-12-24 22:46:41 +08:00
1.add more information for command info and config get
2.fix log file symbol link error
This commit is contained in:
parent
bd9d2ed57e
commit
45661645ed
@ -899,7 +899,8 @@ void Handler::infoRequest(Request* req, const String& key)
|
|||||||
#define Scope(all, empty, header) ((all || empty || key.equal(header, true)) ? \
|
#define Scope(all, empty, header) ((all || empty || key.equal(header, true)) ? \
|
||||||
(buf = buf->fappend("# %s\n", header)) : nullptr)
|
(buf = buf->fappend("# %s\n", header)) : nullptr)
|
||||||
|
|
||||||
if (Scope(all, empty, "Proxy")) {
|
if (all || empty || key.equal("Proxy", true) || key.equal("Server", true)) {
|
||||||
|
buf = buf->fappend("# %s\n", "Proxy");
|
||||||
buf = buf->fappend("Version:%s\n", _PREDIXY_VERSION_);
|
buf = buf->fappend("Version:%s\n", _PREDIXY_VERSION_);
|
||||||
buf = buf->fappend("Name:%s\n", mProxy->conf()->name());
|
buf = buf->fappend("Name:%s\n", mProxy->conf()->name());
|
||||||
buf = buf->fappend("Bind:%s\n", mProxy->conf()->bind());
|
buf = buf->fappend("Bind:%s\n", mProxy->conf()->bind());
|
||||||
@ -1196,6 +1197,11 @@ void Handler::configGetRequest(Request* req)
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
Append("Name", "%s", conf->name());
|
||||||
|
Append("Bind", "%s", conf->bind());
|
||||||
|
Append("WorkerThreads", "%d", conf->workerThreads());
|
||||||
|
Append("BufSize", "%d", Buffer::getSize());
|
||||||
|
Append("LocalDC", "%s", conf->localDC().c_str());
|
||||||
Append("MaxMemory", "%ld", AllocBase::getMaxMemory());
|
Append("MaxMemory", "%ld", AllocBase::getMaxMemory());
|
||||||
Append("ClientTimeout", "%d", conf->clientTimeout() / 1000000);
|
Append("ClientTimeout", "%d", conf->clientTimeout() / 1000000);
|
||||||
Append("AllowMissLog", "%s", log->allowMissLog() ? "true" : "false");
|
Append("AllowMissLog", "%s", log->allowMissLog() ? "true" : "false");
|
||||||
|
|||||||
@ -118,7 +118,9 @@ bool LogFileSink::reopen(time_t t)
|
|||||||
}
|
}
|
||||||
if (mFileSuffixFmt) {
|
if (mFileSuffixFmt) {
|
||||||
unlink(mFileName.c_str());
|
unlink(mFileName.c_str());
|
||||||
if (symlink(mFilePath, mFileName.c_str()) == -1) {
|
const char* name = strrchr(mFilePath, '/');
|
||||||
|
name = name ? name + 1 : mFilePath;
|
||||||
|
if (symlink(name, mFileName.c_str()) == -1) {
|
||||||
fprintf(stderr, "create symbol link for %s fail", mFileName.c_str());
|
fprintf(stderr, "create symbol link for %s fail", mFileName.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,10 +137,10 @@ bool LogFileSink::setFile(const char* path, int rotateSecs, long rotateBytes)
|
|||||||
if (len > 4 && strcasecmp(path + len - 4, ".log") == 0) {
|
if (len > 4 && strcasecmp(path + len - 4, ".log") == 0) {
|
||||||
len -= 4;
|
len -= 4;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (len + FileSuffixReserveLen >= MaxPathLen) {
|
if (len + FileSuffixReserveLen >= MaxPathLen) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
mFileName = path;
|
mFileName = path;
|
||||||
mFilePathLen = len;
|
mFilePathLen = len;
|
||||||
memcpy(mFilePath, path, len);
|
memcpy(mFilePath, path, len);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user