2 * Copyright 2013 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #ifdef MYFILE_CRITICAL_LOG
31 static FILE *g_fp = NULL;
36 process_id = getpid();
38 char *result_file = g_strdup_printf("%s-%d", MF_LOG_RESULT_FILE, (int)process_id);
39 if (result_file == NULL)
40 return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
42 g_fp = fopen(result_file, "at+");
46 return MYFILE_ERR_FILE_OPEN_FAIL;
50 return MYFILE_ERR_NONE;
52 void mf_log_finalize()
61 int mf_log_record(char *filename, const char *function, int line, char *fmt, ...)
64 return MYFILE_ERR_INVALID_ARG;
68 va_start(arg_ptr, fmt);
69 message = g_strdup_vprintf(fmt, arg_ptr);
72 fprintf(g_fp, MF_LOG_FORMAT, filename, function, line, message);
73 if (message != NULL) {
78 return MYFILE_ERR_NONE;