Skip to content

Commit

Permalink
perf: log: use git submodule
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
  • Loading branch information
zhaojh329 committed May 12, 2021
1 parent b1a3f19 commit b5db8c3
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 202 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
version=${{ steps.get-version.outputs.version-without-v }}
cd ..
cp -r rtty rtty-$version
rm -rf rtty-$version/.git* rtty-$version/src/buffer/.git* rtty-$version/src/ssl/.git*
rm -rf rtty-$version/.git* rtty-$version/src/buffer/.git* rtty-$version/src/ssl/.git* rtty-$version/src/log/.git*
tar zcfv rtty-$version.tar.gz rtty-$version
echo "::set-output name=asset-path::../rtty-$version.tar.gz"
echo "::set-output name=asset-name::rtty-$version.tar.gz"
Expand Down
7 changes: 5 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[submodule "src/buffer"]
path = src/buffer
url = https://github.com/zhaojh329/buffer.git
url = https://gitee.com/zhaojh329/buffer.git
[submodule "src/ssl"]
path = src/ssl
url = https://github.com/zhaojh329/ssl.git
url = https://gitee.com/zhaojh329/ssl.git
[submodule "src/log"]
path = src/log
url = https://github.com/zhaojh329/log.git
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set(RTTY_VERSION_PATCH 0)
find_package(Libev REQUIRED)

aux_source_directory(. SRCS)
aux_source_directory(log SRCS)
aux_source_directory(buffer SRCS)

add_executable(rtty ${SRCS})
Expand Down
2 changes: 1 addition & 1 deletion src/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <math.h>
#include <pwd.h>

#include "log.h"
#include "log/log.h"
#include "list.h"
#include "utils.h"
#include "command.h"
Expand Down
6 changes: 3 additions & 3 deletions src/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <sys/statvfs.h>
#include <linux/limits.h>

#include "log.h"
#include "log/log.h"
#include "file.h"
#include "list.h"
#include "rtty.h"
Expand Down Expand Up @@ -143,7 +143,7 @@ static int start_upload_file(struct file_context *ctx, const char *path)

fd = open(path, O_RDONLY);
if (fd < 0) {
log_err("open '%s' fail\n", path, strerror(errno));
log_err("open '%s' fail: %s\n", path, strerror(errno));
return -1;
}

Expand Down Expand Up @@ -295,7 +295,7 @@ static void start_download_file(struct file_context *ctx, struct buffer *info, i
log_info("download file: %s, size: %u\n", savepath, ctx->total_size);

if (fchown(fd, ctx->uid, ctx->gid) < 0)
log_err("fchown %s fail: %s\n", strerror(errno));
log_err("fchown %s fail: %s\n", savepath, strerror(errno));

if (ctx->total_size == 0)
close(fd);
Expand Down
1 change: 1 addition & 0 deletions src/log
Submodule log added at f4ce2d
143 changes: 0 additions & 143 deletions src/log.c

This file was deleted.

46 changes: 0 additions & 46 deletions src/log.h

This file was deleted.

6 changes: 3 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <stdlib.h>
#include <getopt.h>

#include "log.h"
#include "log/log.h"
#include "rtty.h"

enum {
Expand Down Expand Up @@ -197,8 +197,8 @@ int main(int argc, char **argv)
if (background && daemon(0, 0))
log_err("Can't run in the background: %s\n", strerror(errno));

if (!verbose)
set_log_threshold(LOG_ERR);
if (verbose)
log_level(LOG_DEBUG);

log_info("rtty version %s\n", RTTY_VERSION_STRING);

Expand Down
2 changes: 1 addition & 1 deletion src/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#include "list.h"
#include "net.h"
#include "log.h"
#include "log/log.h"

struct net_context {
struct ev_timer tmr;
Expand Down
2 changes: 1 addition & 1 deletion src/rtty.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
#include <sys/sysinfo.h>

#include "net.h"
#include "log.h"
#include "web.h"
#include "file.h"
#include "rtty.h"
#include "list.h"
#include "utils.h"
#include "command.h"
#include "log/log.h"

static char login_path[128]; /* /bin/login */

Expand Down
2 changes: 1 addition & 1 deletion src/web.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#include "web.h"
#include "net.h"
#include "log.h"
#include "log/log.h"

void web_request_free(struct web_request_ctx *ctx)
{
Expand Down

0 comments on commit b5db8c3

Please sign in to comment.