Skip to content

Commit b9fe658

Browse files
committed
refactor: Rename LOG_JSON to LOG_FORMAT for flexible log output
Replace boolean LOG_JSON configuration with string-based LOG_FORMAT to support multiple output formats (json/text) instead of just toggling JSON on/off. This provides clearer semantics and allows for future format extensions. Changes: - Rename LOG_JSON environment variable to LOG_FORMAT - Update default value from true to "json" to maintain backward compatibility - Update documentation in English and Japanese to reflect format options - Update Docker entrypoint script and integration test configurations
1 parent cc96c19 commit b9fe658

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ API_PORT=11016
6464
# Logging Configuration
6565
# ============================================================================
6666
LOG_LEVEL=info
67-
LOG_JSON=true
67+
LOG_FORMAT=json
6868

6969
# ============================================================================
7070
# Docker Compose Configuration

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ services:
8888

8989
# Logging Configuration
9090
LOG_LEVEL: ${LOG_LEVEL:-info}
91-
LOG_JSON: ${LOG_JSON:-true}
91+
LOG_FORMAT: ${LOG_FORMAT:-json}
9292
ports:
9393
- "${API_PORT:-11016}:${API_PORT:-11016}"
9494
volumes:

docs/en/configuration.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ allow_cidrs:
600600
```yaml
601601
logging:
602602
level: "info" # Log level
603-
json: true # JSON format output
603+
format: "json" # Log output format: "json" or "text"
604604
file: "" # Log file path (empty = stdout)
605605
```
606606

@@ -609,7 +609,7 @@ logging:
609609
| Parameter | Type | Default | Description | Hot Reload |
610610
|-----------|------|---------|-------------|------------|
611611
| `level` | string | `info` | Log level: `debug`, `info`, `warn`, `error` | ✅ Yes |
612-
| `json` | boolean | `true` | JSON format output (recommended for production) | ❌ No |
612+
| `format` | string | `json` | Log output format: `json` (structured) or `text` (human-readable) | ❌ No |
613613
| `file` | string | `` | Log file path (empty = stdout, required for daemon mode) | ❌ No |
614614

615615
**Log Levels**:
@@ -618,9 +618,9 @@ logging:
618618
- **`warn`**: Warnings (anomalies that don't require immediate action)
619619
- **`error`**: Errors (require attention)
620620

621-
**JSON Logging**:
622-
- Recommended for **production** (easier to parse, structured)
623-
- Disable for **development** (human-readable)
621+
**Log Formats**:
622+
- **`json`**: Structured JSON format (recommended for production, easier to parse)
623+
- **`text`**: Human-readable key=value format (recommended for development)
624624

625625
**Log Output**:
626626
- **Empty `file`**: Log to stdout (recommended for Docker/systemd)

docs/en/docker-deployment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ API_PORT=11016 # API port
9696
#### Logging
9797
```bash
9898
LOG_LEVEL=info # Log level: debug, info, warn, error
99-
LOG_JSON=true # JSON log format
99+
LOG_FORMAT=json # Log format: json or text
100100
```
101101

102102
### Custom Configuration File
@@ -169,7 +169,7 @@ API_PORT=11016
169169

170170
# Production logging
171171
LOG_LEVEL=info
172-
LOG_JSON=true
172+
LOG_FORMAT=json
173173
```
174174

175175
3. Start with production configuration:

docs/ja/configuration.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ allow_cidrs:
600600
```yaml
601601
logging:
602602
level: "info" # ログレベル
603-
json: true # JSON形式出力
603+
format: "json" # ログ出力形式: "json" または "text"
604604
file: "" # ログファイルパス(空 = stdout)
605605
```
606606

@@ -609,7 +609,7 @@ logging:
609609
| パラメータ | 型 | デフォルト | 説明 | ホットリロード |
610610
|-----------|------|---------|-------------|------------|
611611
| `level` | string | `info` | ログレベル: `debug`、`info`、`warn`、`error` | ✅ 可能 |
612-
| `json` | boolean | `true` | JSON形式出力(本番環境で推奨) | ❌ 不可 |
612+
| `format` | string | `json` | ログ出力形式: `json`(構造化) または `text`(人間が読みやすい) | ❌ 不可 |
613613
| `file` | string | `` | ログファイルパス(空 = stdout、デーモンモードでは必須) | ❌ 不可 |
614614

615615
**ログレベル**:
@@ -618,9 +618,9 @@ logging:
618618
- **`warn`**: 警告(即座の対応が不要な異常)
619619
- **`error`**: エラー(注意が必要)
620620

621-
**JSONロギング**:
622-
- **本番環境**で推奨(解析が容易、構造化されている)
623-
- **開発環境**では無効化(人間が読みやすい)
621+
**ログ形式**:
622+
- **`json`**: 構造化JSON形式(本番環境で推奨、解析が容易)
623+
- **`text`**: 人間が読みやすいkey=value形式(開発環境で推奨)
624624

625625
**ログ出力**:
626626
- **空の`file`**: stdoutに出力(Docker/systemdで推奨)

docs/ja/docker-deployment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ API_PORT=11016 # APIポート
9696
#### ロギング
9797
```bash
9898
LOG_LEVEL=info # ログレベル: debug, info, warn, error
99-
LOG_JSON=true # JSON形式のログ
99+
LOG_FORMAT=json # ログ形式: json または text
100100
```
101101

102102
### カスタム設定ファイル
@@ -169,7 +169,7 @@ API_PORT=11016
169169

170170
# 本番ロギング
171171
LOG_LEVEL=info
172-
LOG_JSON=true
172+
LOG_FORMAT=json
173173
```
174174

175175
3. 本番設定で起動:

support/docker/entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ API_BIND=${API_BIND:-0.0.0.0}
5757
API_PORT=${API_PORT:-11016}
5858

5959
LOG_LEVEL=${LOG_LEVEL:-info}
60-
LOG_JSON=${LOG_JSON:-true}
60+
LOG_FORMAT=${LOG_FORMAT:-json}
6161

6262
CONFIG_FILE=${CONFIG_FILE:-/etc/mygramdb/config.yaml}
6363

@@ -133,7 +133,7 @@ api:
133133
# Logging
134134
logging:
135135
level: "${LOG_LEVEL}"
136-
json: ${LOG_JSON}
136+
format: "${LOG_FORMAT}"
137137
EOF
138138

139139
echo "Configuration file generated at: $CONFIG_FILE"

tests/integration/scripts/daemon_mode.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ api:
6666
6767
logging:
6868
level: "info"
69-
json: true
69+
format: "json"
7070
file: "/tmp/mygramdb_daemon_test.log"
7171
EOF
7272

0 commit comments

Comments
 (0)