refine log format (#312)

### What problem does this PR solve?

Issue link:#264
### Type of change


- [x] Documentation Update
- [x] Refactoring
This commit is contained in:
KevinHuSh
2024-04-11 10:13:43 +08:00
committed by GitHub
parent 0b2808f990
commit f6c7204002
9 changed files with 15 additions and 18 deletions

View File

@@ -695,7 +695,7 @@ class Dialog(DataBaseModel):
language = CharField(
max_length=32,
null=True,
default="English",
default="Chinese",
help_text="English|Chinese")
llm_id = CharField(max_length=32, null=False, help_text="default llm ID")
llm_setting = JSONField(null=False, default={"temperature": 0.1, "top_p": 0.3, "frequency_penalty": 0.7,

View File

@@ -13,15 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import logging
from rag.utils import ELASTICSEARCH
from rag.nlp import search
import os
from enum import IntEnum, Enum
from api.utils import get_base_config, decrypt_database_config
from api.utils.file_utils import get_project_base_directory
from api.utils.log_utils import LoggerFactory, getLogger
@@ -32,13 +25,16 @@ LoggerFactory.set_directory(
"logs",
"api"))
# {CRITICAL: 50, FATAL:50, ERROR:40, WARNING:30, WARN:30, INFO:20, DEBUG:10, NOTSET:0}
LoggerFactory.LEVEL = 10
LoggerFactory.LEVEL = 30
stat_logger = getLogger("stat")
access_logger = getLogger("access")
database_logger = getLogger("database")
chat_logger = getLogger("chat")
database_logger.setLevel(logging.WARNING)
from rag.utils import ELASTICSEARCH
from rag.nlp import search
from api.utils import get_base_config, decrypt_database_config
API_VERSION = "v1"
RAG_FLOW_SERVICE_NAME = "ragflow"
@@ -79,7 +75,7 @@ default_llm = {
"image2text_model": "glm-4v",
"asr_model": "",
},
"Local": {
"Ollama": {
"chat_model": "qwen-14B-chat",
"embedding_model": "flag-embedding",
"image2text_model": "",

View File

@@ -26,7 +26,8 @@ from api.utils import file_utils
class LoggerFactory(object):
TYPE = "FILE"
LOG_FORMAT = "[%(levelname)s] [%(asctime)s] [jobId] [%(process)s:%(thread)s] - [%(module)s.%(funcName)s] [line:%(lineno)d]: %(message)s"
LOG_FORMAT = "[%(levelname)s] [%(asctime)s] [%(module)s.%(funcName)s] [line:%(lineno)d]: %(message)s"
logging.basicConfig(format=LOG_FORMAT)
LEVEL = logging.DEBUG
logger_dict = {}
global_handler_dict = {}