Skip to content

Commit

Permalink
Modify parameters name
Browse files Browse the repository at this point in the history
  • Loading branch information
杨赫然 committed Oct 17, 2024
1 parent 5893410 commit acb315a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions common/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static int ccnet_log_level;
static int seafile_log_level;
static char *logfile;
static FILE *logfp;
static gboolean to_stdout = FALSE;
static gboolean log_to_stdout = FALSE;

#ifndef WIN32
#ifdef SEAFILE_SERVER
Expand Down Expand Up @@ -62,7 +62,7 @@ seafile_log (const gchar *log_domain, GLogLevelFlags log_level,
if (log_level > seafile_log_level)
return;

if (to_stdout) {
if (log_to_stdout) {
fputs ("[seaf-server] ", logfp);
}

Expand Down Expand Up @@ -155,11 +155,11 @@ seafile_log_init (const char *_logfile, const char *ccnet_debug_level_str,
ccnet_log_level = get_debug_level(ccnet_debug_level_str, G_LOG_LEVEL_INFO);
seafile_log_level = get_debug_level(seafile_debug_level_str, G_LOG_LEVEL_DEBUG);

const char *log_to_stdout = g_getenv("SEAFILE_LOG_TO_STDOUT");
if (g_strcmp0(_logfile, "-") == 0 || g_strcmp0(log_to_stdout, "true") == 0) {
const char *log_to_stdout_env = g_getenv("SEAFILE_LOG_TO_STDOUT");
if (g_strcmp0(_logfile, "-") == 0 || g_strcmp0(log_to_stdout_env, "true") == 0) {
logfp = stdout;
logfile = g_strdup (_logfile);
to_stdout = TRUE;
log_to_stdout = TRUE;
}
else {
logfile = ccnet_expand_path(_logfile);
Expand All @@ -177,7 +177,7 @@ seafile_log_reopen ()
{
FILE *fp, *oldfp;

if (g_strcmp0(logfile, "-") == 0 || to_stdout)
if (g_strcmp0(logfile, "-") == 0 || log_to_stdout)
return 0;

if ((fp = g_fopen (logfile, "a+")) == NULL) {
Expand Down
8 changes: 4 additions & 4 deletions fileserver/fileserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var logFp *os.File
var dbType string
var seafileDB, ccnetDB *sql.DB

var toStdout bool
var logToStdout bool

func init() {
flag.StringVar(&centralDir, "F", "", "central config directory")
Expand All @@ -55,7 +55,7 @@ func init() {

env := os.Getenv("SEAFILE_LOG_TO_STDOUT")
if env == "true" {
toStdout = true
logToStdout = true
}

log.SetFormatter(&LogFormatter{})
Expand All @@ -76,11 +76,11 @@ func (f *LogFormatter) Format(entry *log.Entry) ([]byte, error) {
}
level := fmt.Sprintf("[%s] ", levelStr)
appName := ""
if toStdout {
if logToStdout {
appName = "[fileserver] "
}
buf := make([]byte, 0, len(appName)+len(timestampFormat)+len(level)+len(entry.Message)+1)
if toStdout {
if logToStdout {
buf = append(buf, appName...)
}
buf = entry.Time.AppendFormat(buf, timestampFormat)
Expand Down

0 comments on commit acb315a

Please sign in to comment.