question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom logger support

See original GitHub issue

Original report by @MCArth:

what might be an interesting addition to the engine would be the ability to set logging levels of colyseus (and then there be an ‘error only’ level which excludes this/seat reservation expired that could be called warnings or something) but that’s a lot of work and tbh I should just set up my own logging system haha


The disadvantage of using console.log directly inside the Colyseus’ codebase (which we currently do) is that all internal logs are forcibly going to go to stdout, making it not possible to easily forward logs and errors to external services.

We can do exactly as the web framework fastify: use a small abstract-logging library for logs, and default it to console to keep current functionality.

There are quite a few logging frameworks available for Node.js, such as winston, bunyan, pino, etc. By using an abstract logger, end-users could provide whichever logging library they prefer:

Example providing a pino logger:

import pino from "pino";
const transport = pino.transport({
  target: 'some-transport',
  options: { some: 'options for', the: 'transport' }
})
const logger = pino(transport);

const server = new Server({
  // provide the custom logger. 
  // default: console
  logger: logger,
});

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
endelcommented, Sep 28, 2021

Hi @lpsandaruwan, sounds good to me! Can we also have it optional in the Server constructor? Then all Colyseus configurations can be provided from a single place.

0reactions
github-actions[bot]commented, Nov 5, 2021

This issue was closed because it has been stalled for 7 days with no activity.

Read more comments on GitHub >

github_iconTop Results From Across the Web

custom-logger-service - npm
CUstomLoggerService is an utility service that helps you to display debugging, error, informative, log, and warning messages. This tool is made ...
Read more >
Implement a custom logging provider - .NET - Microsoft Learn
In this article, you'll learn how to implement a custom logging provider that can be used to colorize logs in the console.
Read more >
Building a Custom Logger with Active Support Tagged Logging
Active Support provides some additional flexible logging classes that we can use to customize logging functionality in our Rails app.
Read more >
6.4 Creating and Using Custom Loggers - Documentation
Configure a custom logger in the main <installdir> \conf\loggers.xml file and make it the default, or add it to the splitter that defines...
Read more >
Creating Custom Loggers - SugarCRM Support Site
Custom loggers, defined in ./custom/include/SugarLogger/ , can be used to write log entries to a centralized application management tool or ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found