Skip to content

Commit f72b065

Browse files
Minor additions to docs and added module to logging
1 parent 48bf9a3 commit f72b065

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

docs/development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ codegate/
5151
│ ├── cli.py # Command-line interface
5252
│ ├── config.py # Configuration management
5353
│ ├── exceptions.py # Shared exceptions
54-
│ ├── logging.py # Logging setup
54+
│ ├── codegate_logging.py # Logging setup
5555
│ ├── prompts.py # Prompts management
5656
│ ├── server.py # Main server implementation
5757
│ └── providers/ # External service providers

docs/logging.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Logging System
22

3-
The logging system in Codegate (`logging.py`) provides a flexible and structured logging solution with support for both JSON and text formats.
3+
The logging system in Codegate (`codegate_logging.py`) provides a flexible and structured logging solution with support for both JSON and text formats.
44

55
## Log Routing
66

@@ -18,9 +18,9 @@ When using JSON format (default), log entries include:
1818
```json
1919
{
2020
"timestamp": "YYYY-MM-DDThh:mm:ss.mmmZ",
21-
"level": "LOG_LEVEL",
21+
"log_level": "LOG_LEVEL",
2222
"module": "MODULE_NAME",
23-
"message": "Log message",
23+
"event": "Log message",
2424
"extra": {
2525
// Additional fields as you desire
2626
}
@@ -49,9 +49,9 @@ YYYY-MM-DDThh:mm:ss.mmmZ - LEVEL - NAME - MESSAGE
4949
### Basic Logging
5050

5151
```python
52-
import logging
52+
import structlog
5353

54-
logger = logging.getLogger(__name__)
54+
logger = structlog.get_logger(__name__)
5555

5656
# Different log levels
5757
logger.info("This is an info message")

src/codegate/codegate_logging.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ def setup_logging(
7272
shared_processors = [
7373
structlog.processors.add_log_level,
7474
structlog.processors.TimeStamper(fmt="%Y-%m-%dT%H:%M:%S.%03dZ", utc=True),
75+
structlog.processors.CallsiteParameterAdder(
76+
[
77+
structlog.processors.CallsiteParameter.MODULE,
78+
]
79+
),
7580
]
7681
# Not sure why this is needed. I think it is a wrapper for the standard logging module.
7782
# Should allow to log both with structlog and the standard logging module:

0 commit comments

Comments
 (0)