Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add use local time and show caller infomation #31

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions lab/logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,45 @@ logs:

{% endcode %}

### Use Local Time

RoadRunner uses UTC time in logs by default. However, you can configure it to use local time format if your application operates within a single timezone or when local time is more appropriate for your use case.

{% code title=".rr.yaml" %}

```yaml
logs:
mode: development
use_local_time: true # Use local time instead of UTC
```

{% endcode %}

Example output with local time:

```
2024-01-10 15:04:05.123 INFO Server started
```

### Show Caller Information

You can enable the caller information in log messages, which shows the source file and line number where the log was generated. This is particularly useful for custom plugin development.

{% code title=".rr.yaml" %}

```yml
logs:
mode: development
show_caller: true # Enable caller information in logs
```

{% endcode %}

When enabled, log messages will include the caller information:

- In console mode: The caller path will be displayed with color and proper alignment
- In JSON mode: The caller information will be included in the "caller" field

### Channels

In addition, you can configure each plugin log messages individually using the `channels` section. It allows you to
Expand Down