nextcloud-libraries / nextcloud-libraries/nextcloud-logger

Allow debug logging that can be enabled / disabled

Open
#894 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3
Forks
3
Avg merge
3m
Merged PRs (30d)
11

Description

Use case

In the text app we sometimes need very detailed logging. Think several lines of debug logging per keystroke.

Currently we have some logging statements commented out that we enable then.
But if they were always enabled that would spam the logs too much.

Would be nice to have this build into the logger.

Possible interface

// ExampleService.ts in the text app
const logger = getLoggerBuilder().setApp('text')... .build()
const debug = logger.createOptionalDebugLogger('ExampleService')
...
service.on('update', (update) => debug('received update', { update }))

Usage in the Browser console:

OCA.Logger.debug.text.ExampleService = true

Populating OCA.Logger.debug when the optional debug logger is created would enable auto completion on the browser command line.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names getLoggerBuilder(), createOptionalDebugLogger(), and OCA.Logger.debug; start by tracing those entry points in the TypeScript logger implementation. Confirm how optional loggers should expose their app and service keys and how the browser toggle controls output. Done means the proposed API works without default debug spam and the browser console object is populated for autocomplete.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.