ASCII ART FTW
This commit is contained in:
parent
a54d9805ee
commit
996d503d1a
@ -83,7 +83,7 @@ redis-check-dump.o: redis-check-dump.c lzf.h
|
|||||||
redis-cli.o: redis-cli.c fmacros.h version.h ../deps/hiredis/hiredis.h \
|
redis-cli.o: redis-cli.c fmacros.h version.h ../deps/hiredis/hiredis.h \
|
||||||
sds.h zmalloc.h ../deps/linenoise/linenoise.h help.h
|
sds.h zmalloc.h ../deps/linenoise/linenoise.h help.h
|
||||||
redis.o: redis.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
redis.o: redis.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
||||||
zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
|
zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h asciilogo.h
|
||||||
release.o: release.c release.h
|
release.o: release.c release.h
|
||||||
replication.o: replication.c redis.h fmacros.h config.h ae.h sds.h dict.h \
|
replication.o: replication.c redis.h fmacros.h config.h ae.h sds.h dict.h \
|
||||||
adlist.h zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
|
adlist.h zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
|
||||||
|
18
src/asciilogo.h
Normal file
18
src/asciilogo.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
char *ascii_logo =
|
||||||
|
" _._ \n"
|
||||||
|
" _.-``__ ''-._ \n"
|
||||||
|
" _.-`` `. `_. ''-._ Redis %s (%s/%d) %s bit\n"
|
||||||
|
" .-`` .-```. ```\\/ _.,_ ''-._ \n"
|
||||||
|
" ( ' , .-` | `, ) Running in %s mode\n"
|
||||||
|
" |`-._`-...-` __...-.``-._|'` _.-'| Port: %d\n"
|
||||||
|
" | `-._ `._ / _.-' | PID: %ld\n"
|
||||||
|
" `-._ `-._ `-./ _.-' _.-' \n"
|
||||||
|
" |`-._`-._ `-.__.-' _.-'_.-'| \n"
|
||||||
|
" | `-._`-._ _.-'_.-' | http://redis.io \n"
|
||||||
|
" `-._ `-._`-.__.-'_.-' _.-' \n"
|
||||||
|
" |`-._`-._ `-.__.-' _.-'_.-'| \n"
|
||||||
|
" | `-._`-._ _.-'_.-' | \n"
|
||||||
|
" `-._ `-._`-.__.-'_.-' _.-' \n"
|
||||||
|
" `-._ `-.__.-' _.-' \n"
|
||||||
|
" `-._ _.-' \n"
|
||||||
|
" `-.__.-' \n\n";
|
30
src/redis.c
30
src/redis.c
@ -205,14 +205,20 @@ void redisLogRaw(int level, const char *msg) {
|
|||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
int rawmode = (level & REDIS_LOG_RAW);
|
||||||
|
|
||||||
|
level &= 0xff; /* clear flags */
|
||||||
if (level < server.verbosity) return;
|
if (level < server.verbosity) return;
|
||||||
|
|
||||||
fp = (server.logfile == NULL) ? stdout : fopen(server.logfile,"a");
|
fp = (server.logfile == NULL) ? stdout : fopen(server.logfile,"a");
|
||||||
if (!fp) return;
|
if (!fp) return;
|
||||||
|
|
||||||
strftime(buf,sizeof(buf),"%d %b %H:%M:%S",localtime(&now));
|
if (rawmode) {
|
||||||
fprintf(fp,"[%d] %s %c %s\n",(int)getpid(),buf,c[level],msg);
|
fprintf(fp,"%s",msg);
|
||||||
|
} else {
|
||||||
|
strftime(buf,sizeof(buf),"%d %b %H:%M:%S",localtime(&now));
|
||||||
|
fprintf(fp,"[%d] %s %c %s\n",(int)getpid(),buf,c[level],msg);
|
||||||
|
}
|
||||||
fflush(fp);
|
fflush(fp);
|
||||||
|
|
||||||
if (server.logfile) fclose(fp);
|
if (server.logfile) fclose(fp);
|
||||||
@ -227,7 +233,7 @@ void redisLog(int level, const char *fmt, ...) {
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
char msg[REDIS_MAX_LOGMSG_LEN];
|
char msg[REDIS_MAX_LOGMSG_LEN];
|
||||||
|
|
||||||
if (level < server.verbosity) return;
|
if ((level&0xff) < server.verbosity) return;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsnprintf(msg, sizeof(msg), fmt, ap);
|
vsnprintf(msg, sizeof(msg), fmt, ap);
|
||||||
@ -1715,6 +1721,23 @@ void usage() {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void redisAsciiArt(void) {
|
||||||
|
#include "asciilogo.h"
|
||||||
|
char *buf = zmalloc(1024*16);
|
||||||
|
|
||||||
|
snprintf(buf,1024*16,ascii_logo,
|
||||||
|
REDIS_VERSION,
|
||||||
|
redisGitSHA1(),
|
||||||
|
strtol(redisGitDirty(),NULL,10) > 0,
|
||||||
|
(sizeof(long) == 8) ? "64" : "32",
|
||||||
|
server.cluster_enabled ? "cluster" : "stand alone",
|
||||||
|
server.port,
|
||||||
|
(long) getpid()
|
||||||
|
);
|
||||||
|
redisLogRaw(REDIS_NOTICE|REDIS_LOG_RAW,buf);
|
||||||
|
zfree(buf);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
long long start;
|
long long start;
|
||||||
|
|
||||||
@ -1733,6 +1756,7 @@ int main(int argc, char **argv) {
|
|||||||
if (server.daemonize) daemonize();
|
if (server.daemonize) daemonize();
|
||||||
initServer();
|
initServer();
|
||||||
if (server.daemonize) createPidFile();
|
if (server.daemonize) createPidFile();
|
||||||
|
redisAsciiArt();
|
||||||
redisLog(REDIS_NOTICE,"Server started, Redis version " REDIS_VERSION);
|
redisLog(REDIS_NOTICE,"Server started, Redis version " REDIS_VERSION);
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
linuxOvercommitMemoryWarning();
|
linuxOvercommitMemoryWarning();
|
||||||
|
@ -179,6 +179,7 @@
|
|||||||
#define REDIS_VERBOSE 1
|
#define REDIS_VERBOSE 1
|
||||||
#define REDIS_NOTICE 2
|
#define REDIS_NOTICE 2
|
||||||
#define REDIS_WARNING 3
|
#define REDIS_WARNING 3
|
||||||
|
#define REDIS_LOG_RAW (1<<10) /* Modifier to log without timestamp */
|
||||||
|
|
||||||
/* Anti-warning macro... */
|
/* Anti-warning macro... */
|
||||||
#define REDIS_NOTUSED(V) ((void) V)
|
#define REDIS_NOTUSED(V) ((void) V)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user