#separating logs

1 messages · Page 1 of 1 (latest)

ruby crow
#
.
├── bot
   ├── ext
      ├── db
         ├── scripts
            └── setup.sql
         └── core.py
      └── struct.py
   ├── modules
      └── todo.py
   ├── constants.py
   ├── __init__.py
   └── __main__.py
├── tests
   └── __init__.py
├── configuration.yml
├── CONTRIBUTING.md
├── LICENSE
├── Makefile
├── poetry.lock
├── pyproject.toml
└── README.md```

So I wanted to have different formatting for hikari logs and logs of my bot. Thus I tried putting
```py
logging.basicConfig(
    level=logging.INFO, format="%(message)s", datefmt="[%X]", handlers=[RichHandler()]
)
logging.config.dictConfig({
    'version': 1,
    'disable_existing_loggers': True,
})

in __main__.py
But when I do that, I only get logs from shard.py (no other file, only that one) in my console for some reason. And the formatting is the one I applied as well.

[13:12:44] INFO     shard is ready: 1 guilds, Todo Bot#9833 (1164152281604837516), session '14da4b00a054fbde0320826ee2a20ff1'  shard.py:744
                    on v10 gateway
^C[13:12:53] INFO     shard has been requested to shutdown                                                                       shard.py:564
           INFO     shard shutdown successfully                                                                                shard.py:577```

(I did C-C once the bot was fully started; command was `py -m bot`)
mellow oxide
#

shards loggers are created in the classes rather than at the module level

#

so those are the only ones that get enabled