{"id":18556306,"url":"https://github.com/maks-io/cheese-log","last_synced_at":"2026-04-10T07:59:10.828Z","repository":{"id":170760855,"uuid":"593631810","full_name":"maks-io/cheese-log","owner":"maks-io","description":"A colorful logger with browser-/environment-dependent formatting possibilities, table printing, object depth limiting, string- and array-truncating, etc.","archived":false,"fork":false,"pushed_at":"2024-11-29T15:38:38.000Z","size":863,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-19T19:58:41.917Z","etag":null,"topics":["ansi-colors","color","colors","debug","error","info","log","logger","logging","table","truncate","warn","warning"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maks-io.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-26T13:46:55.000Z","updated_at":"2024-11-29T15:38:42.000Z","dependencies_parsed_at":"2023-11-14T18:49:18.740Z","dependency_job_id":"e13f3398-5c45-4ec5-a3c6-d768fc31b3ed","html_url":"https://github.com/maks-io/cheese-log","commit_stats":null,"previous_names":["maks-io/cheese-log"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maks-io/cheese-log","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maks-io%2Fcheese-log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maks-io%2Fcheese-log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maks-io%2Fcheese-log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maks-io%2Fcheese-log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maks-io","download_url":"https://codeload.github.com/maks-io/cheese-log/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maks-io%2Fcheese-log/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28915938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T16:37:38.804Z","status":"ssl_error","status_checked_at":"2026-01-30T16:37:37.878Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansi-colors","color","colors","debug","error","info","log","logger","logging","table","truncate","warn","warning"],"created_at":"2024-11-06T21:29:49.397Z","updated_at":"2026-04-10T07:59:10.791Z","avatar_url":"https://github.com/maks-io.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/maks_io"],"categories":[],"sub_categories":[],"readme":"# \u003cspan style=\"font-size: 48px;margin:0;margin-bottom:0;padding-bottom:0;\"\u003e🧀\u003c/span\u003e cheese-log\n\n[![Version](https://img.shields.io/npm/v/cheese-log)](https://www.npmjs.com/package/cheese-log)\n\nA colorful logger with browser-/environment-dependent formatting possibilities.\n\n## Features\n\n- Colorize messages\n- Custom formatting possible based on log level, browser name, OS, and other attributes\n- Display or hide stack trace / origin, timestamp, log level, etc.\n- Shorten arrays, shorten strings, limit object depth of deeply nested objects, etc.\n- Print tables\n- _Set and forget_ mentality, but also allows overriding the logging config for individual logging messages later on\n- Written in typescript\n\nThis logger is not intended to be highly performant, if you are looking for something like that, look somewhere else. This library aims to provide a flexible, versatile and simple logger, to make debugging etc. a slight bit easier.\n\n## README Overview\n\n1. [Install](#install)\n2. [Development](#development)\n3. [Release workflow](#release-workflow)\n4. [Usage examples](#usage-examples)\n   1. [Simple usage](#example-simple-usage)\n   2. [Explore some initial config's props](#example-explore-some-initial-configs-props)\n   3. [Override config for individual log messages](#example-override-config-for-individual-log-messages)\n   4. [Use built-in color functions](#example-use-built-in-color-functions)\n   5. [Use context dependent config instead of a static one](#example-use-context-dependent-config-instead-of-a-static-one)\n   6. [Use a custom formatMessage function](#example-use-a-custom-formatmessage-function)\n   7. [Auto-colorized objects](#example-auto-colorized-objects)\n   8. [Shorten strings](#example-shorten-strings)\n   9. [Shorten arrays](#example-shorten-arrays)\n   10. [Limit object depth](#example-limit-object-depth)\n   11. [Print tables](#example-print-tables)\n5. [Config / options](#config--options)\n6. [Available functions](#available-functions)\n   1. [Config function](#config-function)\n   2. [Basic logging functions](#basic-logging-functions)\n   3. [Built-in table functions](#built-in-table-functions)\n   4. [Built-in color functions](#built-in-color-functions)\n7. [Open tasks / ideas](#open-tasks--ideas)\n\n## Install\n\n```\nnpm install --save cheese-log\n```\n\n## Development\n\nThis repository uses `npm` for local development and automation.\n\n```bash\nnpm install\nnpm run verify\nnpm run commit\n```\n\nThe local commit helper is intentionally a small custom script instead of `commitizen` to avoid extra transitive maintenance and vulnerability surface.\n\nUseful commands:\n\n- `npm run verify`: build the package and run the test suite\n- `npm run pack:check`: preview the published tarball contents locally\n- `npm run release:dry-run`: preview the semantic-release flow without publishing\n\n## Release workflow\n\nReleases are automated with `semantic-release` in GitHub Actions.\n\n- CI runs `npm ci` and `npm run verify`.\n- Releases run on pushes to `main` or `master`, plus manual workflow dispatch.\n- The workflow is designed for protected branches and does not rely on pushing version or changelog commits back to git.\n- Git tags, npm releases, and GitHub Releases are the release source of truth.\n- Because of that, the `package.json` version committed on `main` can lag behind the latest published version.\n- npm Trusted Publishing via GitHub Actions OIDC is the intended publish path. Configure that on npm before the first automated release for this package.\n- The latest historical release has been backfilled locally as tag `v4.0.1` so future semantic-release runs can continue from the correct version line.\n\n## Usage examples\n\nThe following subsections are showing different usage examples of varying complexity. For a full set of options and possibilities however, refer to the options sections [here](#config--options).\n\n### Example: Simple usage\n\n```typescript\nimport { cheese, CheeseConfig } from \"cheese-log\";\n\n// it is mandatory to initialize the cheese logger like so:\nconst cheeseConfig: CheeseConfig = {};\ncheese.config(cheeseConfig);\n\n// now you can use it:\ncheese.log(\"some log message\");\ncheese.info(\"some info message\");\ncheese.debug(\"some debug message\");\ncheese.warn(\"some warn message\");\ncheese.error(\"some error message\");\n```\n\nThe corresponding output in the **Google Chrome** browser's console:\n\n\u003cimg alt=\"cheeseBasicChrome\" src=\"./documentation/media/cheeseBasicChrome.png\" /\u003e\n\nThe default configuration of cheese-log avoids color coding in certain browser, that don't support it. For instance, in **Firefox**, instead of seeing messed up logging messages like this...\n\n\u003cimg alt=\"cheeseBasicFirefoxFlaw\" src=\"./documentation/media/cheeseBasicFirefoxFlaw.png\" /\u003e\n\n...you will instead see un-colored messages like this:\n\n\u003cimg alt=\"cheeseBasicFirefox\" src=\"./documentation/media/cheeseBasicFirefox.png\" /\u003e\n\nYou can always further adjust the mentioned default configuration to avoid colors (or other properties) in certain browsers, operating systems, etc. - see [here](#example-use-context-dependent-config-instead-of-a-static-one).\n\nFurther optimizations are part of the implementation. So does it not use the white logging color for message headers in classical consoles - instead, my IDE would show the same messages like this for example:\n\n\u003cimg alt=\"cheeseBasicIDEConsole\" src=\"./documentation/media/cheeseBasicIDEConsole.png\" /\u003e\n\nMy classical OS terminal would show the output like so:\n\n\u003cimg alt=\"cheeseBasicTerminal\" src=\"./documentation/media/cheeseBasicTerminal.png\" /\u003e\n\nCheck out the live demo at [https://stackblitz.com/edit/cheese-log-simple-usage](https://stackblitz.com/edit/cheese-log-simple-usage?file=index.ts).\n\n### Example: Explore some initial config's props:\n\n```typescript\nimport { cheese, CheeseConfig } from \"cheese-log\";\n\nconst cheeseConfig: CheeseConfig = {\n  showDate: false, // is true by default\n  showCheeseIcon: false, // is true by default\n  showOrigin: true, // is false by default\n};\ncheese.config(cheeseConfig);\n\ncheese.log(\"some log message\");\ncheese.info(\"some info message\");\ncheese.debug(\"some debug message\");\ncheese.warn(\"some warn message\");\ncheese.error(\"some error message\");\n```\n\nThe corresponding output would hide the timestamp and the icon, while showing some stacktrace info:\n\n\u003cimg alt=\"cheeseExplore\" src=\"./documentation/media/cheeseExplore.png\" /\u003e\n\nA full list of config options can be found [here](#config--options).\n\nCheck out the live demo at [https://stackblitz.com/edit/cheese-log-explore-some-config-props](https://stackblitz.com/edit/cheese-log-explore-some-config-props?file=index.ts).\n\n### Example: Override config for individual log messages\n\nYou can override the options for individual messages by using 2 kinds of functions as shown in the following example:\n\n```typescript\nimport { cheese, CheeseConfig } from \"cheese-log\";\n\nconst cheeseConfig: CheeseConfig = {};\ncheese.config(cheeseConfig);\n\ncheese.info(\"some standard info message\");\n\n// 1) _LOGLEVEL functions allow you to pass an option object as the 1st argument...\ncheese._info(\n  // note the leading underscore!\n  { showCheeseIcon: false },\n  \"some info message where the cheese icon is hidden\",\n);\n\n// 2) ...while LOGLEVEL_ functions allow you to pass an option object as the last argument:\ncheese.info_(\"some info message where the timestamp is hidden\", {\n  // note the trailing underscore!\n  showDate: false,\n});\n// ^ Note that you could pass multiple arguments to `._info()` - cheese-log assumes the last argument will be your option object.\n```\n\nThe corresponding output would be:\n\n\u003cimg alt=\"cheeseOverrideOptions\" src=\"./documentation/media/cheeseOverrideOptions.png\" /\u003e\n\nCheck out the live demo at [https://stackblitz.com/edit/cheese-log-override-config](https://stackblitz.com/edit/cheese-log-override-config?file=index.ts).\n\n### Example: Use built-in color functions\n\nCheese-log offers some coloring possibilities. While certain coloring happens automatically for objects, you can always override the color by using the option `colorOverride`. On top of that, to make the coder's life easier, you can instead also use the predefined log functions in the shape `[LOGLEVEL][COLOR]()`, like the following example shows:\n\n```typescript\nimport { cheese, CheeseConfig } from \"cheese-log\";\n\nconst cheeseConfig: CheeseConfig = {};\ncheese.config(cheeseConfig);\n\ncheese.logBlack(\"Some message in a black color\");\ncheese.logGray(\"Some message in a gray color\");\ncheese.logLightgray(\"Some message in a lightgray color\");\ncheese.logWhite(\"Some message in a white color\");\ncheese.logLightyellow(\"Some message in a lightyellow color\");\ncheese.logYellow(\"Some message in a yellow color\");\ncheese.logRed(\"Some message in a red color\");\ncheese.logLightred(\"Some message in a lightred color\");\ncheese.logMagenta(\"Some message in a magenta color\");\ncheese.logLightmagenta(\"Some message in a lightmagenta color\");\ncheese.logBlue(\"Some message in a blue color\");\ncheese.logLightblue(\"Some message in a lightblue color\");\ncheese.logCyan(\"Some message in a cyan color\");\ncheese.logLightcyan(\"Some message in a lightcyan color\");\ncheese.logGreen(\"Some message in a green color\");\ncheese.logLightgreen(\"Some message in a lightgreen color\");\n```\n\nThe corresponding output would be:\n\n\u003cimg alt=\"cheeseColorFunctions\" src=\"./documentation/media/cheeseColorFunctions.png\" /\u003e\n\nYou can also use the color functions with leading and trailing underscores, to pass additional options, for instance:\n\n```typescript\ncheese._logLightblue({ showCheeseIcon: false }, \"hello world\");\ncheese.logMagenta_(\"foo bar\", \"1234\", \"mic check one two\", { showDate: false });\n```\n\nCheck out the live demo at [https://stackblitz.com/edit/cheese-log-built-in-color-functions](https://stackblitz.com/edit/cheese-log-built-in-color-functions?file=index.ts).\n\n### Example: Use context dependent config instead of a static one\n\nConfigs passed to cheese-log can be static option objects as described [here](#config--options) OR you can also pass a function returning such an option object. Advantage of the latter is that you get access to the \"context\" / the \"environment\" - meaning, you can make the output and formatting dependent on the browser name (if any), the operating system and other attributes.\n\nThe following example should be self-explanatory:\n\n```typescript\nimport { cheese, CheeseConfig } from \"cheese-log\";\n\nconst contextDependentCheeseConfig: ContextDependentCheeseConfig = (\n  who,\n  logLevel,\n) =\u003e {\n  if (who.browserName === \"Firefox\" || who.osName === \"Android\") {\n    return { allColorsDisabled: true, showCheeseIcon: false };\n  }\n  return {\n    allColorsDisabled: true,\n    showCheeseIcon: true,\n  };\n};\ncheese.config(contextDependentCheeseConfig);\n\ncheese.info(\"some info message\");\n```\n\nThe resulting output on Chrome would be...\n\n\u003cimg alt=\"cheeseContextDependentChrome\" src=\"./documentation/media/cheeseContextDependentChrome.png\" /\u003e\n\n...and on Firefox and/or Android it would be:\n\n\u003cimg alt=\"cheeseContextDependentFirefox\" src=\"./documentation/media/cheeseContextDependentFirefox.png\" /\u003e\n\nCheck out the live demo at [https://stackblitz.com/edit/cheese-log-context-dependent-config](https://stackblitz.com/edit/cheese-log-context-dependent-config?file=index.ts).\n\n### Example: Use a custom formatMessage function\n\nIf you want to change the format of logged messages, you can do it by passing a custom `formatMessage` function (either to the global cheese config at the beginning, or to individual log messages).\n\nThe function shown below is the default, used by this library. It can serve as a template when creating your own:\n\n```typescript\nconst formatMessageDefault: FormatMessageFn = (\n  message: string,\n  who: Who,\n  showLogLevel: boolean,\n  logLevel: LogLevel,\n  millisecondsSince1970: number,\n  showDate: boolean,\n  dateFormat: string,\n  showOrigin: boolean,\n  autoColorizeObject: boolean,\n  showCheeseIcon: boolean,\n  allColorsDisabled: boolean,\n  colorOverride: string,\n  messagePrefix: string,\n  messageSuffix: string,\n) =\u003e {\n  const cheeseIconPrepared = showCheeseIcon ? CHEESE_ICON + \" \" : \"\";\n  const messagePrefixPrepared = messagePrefix ? messagePrefix + \" \" : \"\";\n  const logLevelPrepared = showLogLevel\n    ? \"[\" + logLevel + \"]\" + (showDate ? \" \" : \"\")\n    : \"\";\n  const datePrepared = showDate\n    ? getTimestamp(dateFormat, millisecondsSince1970)\n    : \"\";\n  const originInfo = showOrigin ? getStackTrace() ?? \"\" : \"\";\n\n  let prefixPrepared = `${cheeseIconPrepared}${messagePrefixPrepared}${logLevelPrepared}${datePrepared}`;\n  if (!allColorsDisabled) {\n    const textColorFn = who.isServerApp ? black : white;\n    if (logLevel === LogLevel.error) {\n      prefixPrepared = bgRed(textColorFn(prefixPrepared));\n    } else if (logLevel === LogLevel.warn) {\n      prefixPrepared = bgYellow(textColorFn(prefixPrepared));\n    } else if (logLevel === LogLevel.info) {\n      prefixPrepared = bgLightGray(textColorFn(prefixPrepared));\n    } else if (logLevel === LogLevel.log) {\n      prefixPrepared = bgDarkGray(textColorFn(prefixPrepared));\n    } else if (logLevel === LogLevel.debug) {\n      prefixPrepared = bgMagenta(textColorFn(prefixPrepared));\n    }\n  }\n\n  const originInfoPrepared = originInfo ? `   ${originInfo}\\n` : \"\";\n  return `${prefixPrepared}\\n${originInfoPrepared}${message}${messageSuffix}`;\n};\n```\n\n**Since version 1.10.0** you can also import `getStackTrace`, `getTimestamp` as well as the individual coloring functions via `ansicolor`, which can be helpful when building your own custom message format function.\n\nCheck out the live demo at [https://stackblitz.com/edit/cheese-log-custom-msg-format-function](https://stackblitz.com/edit/cheese-log-custom-msg-format-function?file=index.ts).\n\n### Example: Auto-colorized objects\n\nWhen logging (nested) objects, the library tries to automatically colorize individual props, according to their type (string would have different colors, than numbers etc.).\nSee the following example:\n\n```typescript\nimport { cheese, CheeseConfig } from \"cheese-log\";\n\ncheese.config({});\n\ncheese.log({\n  this: {\n    is: { someNested: \"object\" },\n    itHasNumbers: 112358,\n    andArrays: [\"hello\", \"world\"],\n  },\n});\n```\n\nThe result:\n\n\u003cimg alt=\"cheeseAutoColorize\" height=\"75\" src=\"./documentation/media/cheeseAutoColorize.png\" /\u003e\n\n### Example: Shorten strings\n\nCheese-log allows you to automatically truncate strings that exceed certain lengths.\n\n```typescript\nimport { cheese, CheeseConfig } from \"cheese-log\";\n\nconst cheeseConfig: CheeseConfig = { maxStringLength: 12 };\ncheese.config(cheeseConfig);\n\ncheese.logBlack(\"Some longer message - in a black color\");\ncheese.logGray(\"Some longer message - in a gray color\");\ncheese.logLightgray(\"Some longer message - in a lightgray color\");\ncheese.logWhite(\"Some longer message - in a white color\");\ncheese.logLightyellow(\"Some longer message - in a lightyellow color\");\ncheese.logYellow(\"Some longer message - in a yellow color\");\ncheese.logRed(\"Some longer message - in a red color\");\ncheese.logLightred(\"Some longer message - in a lightred color\");\ncheese.logMagenta(\"Some longer message - in a magenta color\");\ncheese.logLightmagenta(\"Some longer message - in a lightmagenta color\");\ncheese.logBlue(\"Some longer message - in a blue color\");\ncheese.logLightblue(\"Some longer message - in a lightblue color\");\ncheese.logCyan(\"Some longer message - in a cyan color\");\ncheese.logLightcyan(\"Some longer message - in a lightcyan color\");\ncheese.logGreen(\"Some longer message - in a green color\");\ncheese.logLightgreen(\"Some longer message - in a lightgreen color\");\n```\n\nThe corresonding output would be:\n\n\u003cimg alt=\"cheeseContextShortenStringsSimple\" src=\"./documentation/media/cheeseContextShortenStringsSimple.png\" /\u003e\n\nCheck out the live demo at [https://stackblitz.com/edit/cheese-log-shorten-strings](https://stackblitz.com/edit/cheese-log-shorten-strings?file=index.ts).\n\nThe shortening/truncating of strings also works for values in (nested) objects:\n\n```typescript\ncheese.logGreen({\n  hello: \"world\",\n  msg: \"Some longer message inside an object\",\n});\n```\n\n\u003cimg alt=\"cheeseContextShortenStringsInObject\" src=\"./documentation/media/cheeseContextShortenStringsInObject.png\" /\u003e\n\nIt is allowed to pass `maxStringLength: 0`:\n\n```typescript\nimport { cheese, CheeseConfig } from \"cheese-log\";\n\nconst cheeseConfig: CheeseConfig = { maxStringLength: 0 };\ncheese.config(cheeseConfig);\n\ncheese.logGreen({\n  hello: \"world\",\n  msg: \"Some longer message inside an object\",\n});\n```\n\n\u003cimg alt=\"cheeseContextShortenStringsInObjectZero\" src=\"./documentation/media/cheeseContextShortenStringsInObjectZero.png\" /\u003e\n\nEven when using an uncolored function (which leads to [auto-coloring an object](#example-auto-colorized-objects)), the truncating info in the output will always be highlighted green. The following example logs 2 arguments, a plain string and a nested object -\u003e the latter will be auto-colored, while the plain string will not be auto-colored - see output:\n\n```typescript\ncheese.log(\"a first log argument, which is simply a plain string\", {\n  hello: \"world\",\n  someArray: [1, 2, 3, 4, 5],\n  nested: { hi: \"friends and family\" },\n});\n```\n\n\u003cimg alt=\"cheeseContextShortenStringsInObject2\" src=\"./documentation/media/cheeseContextShortenStringsInObject2.png\" /\u003e\n\n### Example: Shorten arrays\n\nSimilarly to string truncating, you can also let cheese-log automatically shorten arrays exceeding certain lengths:\n\n```typescript\nimport { cheese, CheeseConfig } from \"cheese-log\";\n\nconst cheeseConfig: CheeseConfig = { maxArrayLength: 5 };\ncheese.config(cheeseConfig);\n\ncheese.log(\"some arrays that will be shortened\", [1, 2, 3, 4, 5, 6, 7, 8, 9], {\n  my: \"nested object\",\n  that: \"also holds an array\",\n  here: [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\"],\n});\n```\n\n\u003cimg alt=\"cheeseShortenArrays\" src=\"./documentation/media/cheeseShortenArrays.png\" /\u003e\n\nArray shortening messages are always highlighted with a red background, except for cases where `colorOverride` is being used.\n\nAlso for arrays, passing `maxArrayLength: 0` is a valid option:\n\n\u003cimg alt=\"cheeseShortenArraysZero\" src=\"./documentation/media/cheeseShortenArraysZero.png\" /\u003e\n\nCheck out the live demo at [https://stackblitz.com/edit/cheese-log-shorten-arrays](https://stackblitz.com/edit/cheese-log-shorten-arrays?file=index.ts).\n\n### Example: Limit object depth\n\nAs developers, we often come across situations where we need to deal with deeply nested objects. Fortunately many browser consoles allow collapsing- and expanding-functionalities. For cases where this is not helpful or possible, cheese-log allows to limit the depth of printed objects:\n\n```typescript\nimport { cheese, CheeseConfig } from \"cheese-log\";\n\nconst cheeseConfig: CheeseConfig = { depth: 3 };\ncheese.config(cheeseConfig);\n\ncheese.info({ this: \"is an object with 1 level\" });\ncheese.info({\n  this: \"is an object with 2 levels\",\n  here: { we: \"have a 2nd level\" },\n});\ncheese.info({\n  this: \"is an object with multiple levels\",\n  here: { we: \"have a 2nd level\" },\n  and: { here: { we: \"have a 3rd level\" } },\n  lets: { maybe: { even: { add: \"a 4th level\" } } },\n  finally: {\n    i: { would: { say: { five: \"leves are enough for this example\" } } },\n  },\n});\n```\n\nThe corresponding depth-limited output would be:\n\n\u003cimg alt=\"cheeseDepth\" src=\"./documentation/media/cheeseDepth.png\" /\u003e\n\nCheck out the live demo at [https://stackblitz.com/edit/cheese-log-limit-object-depth](https://stackblitz.com/edit/cheese-log-limit-object-depth?file=index.ts).\n\n### Example: Print tables\n\nIf you need to show data in a row/colum way, you can easily print tables with cheese-log.\nMake sure you provide an array of objects, where every object features the same set of keys, like so:\n\n```typescript\nimport { cheese, CheeseConfig } from \"cheese-log\";\n\nconst cheeseConfig: CheeseConfig = { table: true };\ncheese.config(cheeseConfig);\n\ncheese.debug([\n  { day: \"monday\", task: \"clean house\" },\n  { day: \"tuesday\", task: \"shopping\" },\n  { day: \"wednesday\", task: \"write thesis\" },\n]);\n```\n\nThe corresponding output would be:\n\n\u003cimg alt=\"cheeseTableSimple\" src=\"./documentation/media/cheeseTableSimple.png\" /\u003e\n\nSimilarly to the [built-in color functions](#example-use-built-in-color-functions) you can also use **built-in table functions**, so you don't have to pass the `table: true` prop to the config. Another advantage is that it allows you to define the necessary table data structure via typescript, see the following example:\n\n```typescript\ntype TableData = { colum1: string, column2: string, someNumberColumn: number };\n\ncheese.logTable\u003cTableData\u003e(...);\ncheese._logTable\u003cTableData\u003e(...);\ncheese.logTable_\u003cTableData\u003e(...);\ncheese.infoTable\u003cTableData\u003e(...);\ncheese._infoTable\u003cTableData\u003e(...);\n// ... etc. -\u003e all combinations of log-levels plus 'Table' exist!\n```\n\nYou can adjust a few formatting options for tables, by setting a `tableOptions` prop:\n\n```typescript\nimport { cheese, CheeseConfig } from \"cheese-log\";\n\nconst cheeseConfig: CheeseConfig = {\n  table: true,\n  tableOptions: { rowSeparator: \"-\", headerSeparator: \"=\" },\n  depth: 0,\n};\ncheese.config(cheeseConfig);\n\ncheese.debug([\n  { day: \"monday\", task: \"clean house\" },\n  { day: \"tuesday\", task: [\"shopping\", \"walk dog\"] },\n  { day: \"wednesday\", task: \"write thesis\" },\n  { day: \"thursday\", task: { a: { nested: \"object\" } } },\n]);\n```\n\nThe corresponding output would be:\n\n\u003cimg alt=\"cheeseTable2\" src=\"./documentation/media/cheeseTable2.png\" /\u003e\n\nNote how the individual formatting functionalities also work inside individual table cells (the depth of object has been limited in this example).\n\nCheck out the live demo at [https://stackblitz.com/edit/cheese-log-print-tables](https://stackblitz.com/edit/cheese-log-print-tables?file=index.ts).\n\n## Config / options\n\nWhile the section above shows various example, the following table aims to be a complete list of available options.\n\nFor now, every single prop is optional, not providing it will result in some default value being used - as shown in the table:\n\n| name                       | type                                                                                                                                                                                                                                                                                         | default value                                                                                                                                | description                                                                                                                                                                                                                                                                                                                            |\n| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `allColorsDisabled`        | `boolean \\| (who: Who, logLevel: LogLevel) =\u003e boolean`                                                                                                                                                                                                                                       | `(who: Who) =\u003e who.browserName === \"Firefox\" \\|\\| who.browserName === \"Safari\"`                                                              | If this is set to `true` no ansi colors are being used at all. This is helpful, if your environment is not supporting color codes, for instace. The default value is a function, checking if the logger is running on `Firefox` or `Safari`, in these cases returning `false`, since these browser don't natively support color codes. |\n| `autoColorizeObject`       | `boolean \\| (who: Who, logLevel: LogLevel) =\u003e boolean`                                                                                                                                                                                                                                       | `true`                                                                                                                                       | Logged objects would be automatically colored, as described [here](#example-auto-colorized-objects). You can turn this feature off.                                                                                                                                                                                                    |\n| `colorOverride`            | `CheeseColors`                                                                                                                                                                                                                                                                               | `undefined`                                                                                                                                  | This allows you to colorize entire messages. Using this as part of the global config might be a bit useless, you can however highlight individual messages when used on individual log statements.                                                                                                                                     |\n| `dateFormat`               | `string \\| (who: Who, logLevel: LogLevel) =\u003e string`                                                                                                                                                                                                                                         | `\"YYYY-MM-DD, HH:mm:ss.SSS\"`                                                                                                                 | The date format used for the log statements.                                                                                                                                                                                                                                                                                           |\n| `depth`                    | `number \\| (who: Who, logLevel: LogLevel) =\u003e number`                                                                                                                                                                                                                                         | `100`                                                                                                                                        | The depth of logged objects can be limited, as described [here](#example-limit-object-depth).                                                                                                                                                                                                                                          |\n| `escapeWhitespaces`        | `boolean \\| (who: Who, logLevel: LogLevel) =\u003e boolean`                                                                                                                                                                                                                                       | `false`                                                                                                                                      | If set to `true`, whitespace characters (to be more precise `\\t`, `\\n`, `\\r` and `\\f`) will be escaped, when logging. Note, this does not affect classical spaces `\" \"` though.                                                                                                                                                        |\n| `forceNewlines`            | `boolean \\| (who: Who, logLevel: LogLevel) =\u003e boolean`                                                                                                                                                                                                                                       | `false`                                                                                                                                      | If set to `true` every single logging argument will appear on a new line. If set to `false`, only arrays and objects appear on newlines, successive strings for instance would be printed on the same line though.                                                                                                                     |\n| `formatMessage`            | `(message: string, who: Who, showLogLevel: boolean, logLevel: LogLevel, millisecondsSince1970: number, showDate: boolean, dateFormat: string, showOrigin: boolean, autoColorizeObject: boolean, showCheeseIcon: boolean, allColorsDisabled: boolean, colorOverride: CheeseColors) =\u003e string` | Check [the corresponding code](https://github.com/maks-io/cheese-log/blob/main/src/log/formatMessageDefault.ts) to see the default function. | This function is one of the centerpieces and determines how logged messages appear. Examples can be seen [here](#example-use-a-custom-formatmessage-function).                                                                                                                                                                         |\n| `logLevelEnabled`          | `(logLevel: LogLevel) =\u003e boolean`                                                                                                                                                                                                                                                            | `(logLevel: LogLevel) =\u003e process.env.NODE_ENV !== \"production\"`                                                                              | This function can be used to disable certain log messages in certain scenarios, for instance on production environments.                                                                                                                                                                                                               |\n| `maxArrayLength`           | `number \\| (who: Who, logLevel: LogLevel) =\u003e number`                                                                                                                                                                                                                                         | `10000`                                                                                                                                      | Logging long arrays would truncate them automatically via this option. [See more details](#example-shorten-arrays).                                                                                                                                                                                                                    |\n| `maxStringLength`          | `number \\| (who: Who, logLevel: LogLevel) =\u003e number`                                                                                                                                                                                                                                         | `10000`                                                                                                                                      | Logging long strings would truncate them automatically via this option. [See more details](#example-shorten-strings).                                                                                                                                                                                                                  |\n| `messagePrefix`            | `string \\| (who: Who, logLevel: LogLevel) =\u003e string`                                                                                                                                                                                                                                         | `\"\"`                                                                                                                                         | This message prefix allows you to prepend a certain string to every log message. Please be aware, that the cheese icon - if logged - will appear even before this prefix.                                                                                                                                                              |\n| `messageSuffix`            | `string \\| (who: Who, logLevel: LogLevel) =\u003e string`                                                                                                                                                                                                                                         | `\"\"`                                                                                                                                         | This message suffix allows you to append a certain string to every log message.                                                                                                                                                                                                                                                        |\n| `reportGlobalConfigChange` | `boolean`                                                                                                                                                                                                                                                                                    | `true`                                                                                                                                       | Changing the global config after initialization might be a mistake, therefore a warning will be presented. This warning can be disabled via this option.                                                                                                                                                                               |\n| `reportInitialization`     | `boolean`                                                                                                                                                                                                                                                                                    | `true`                                                                                                                                       | Successfully initializing the logger via `cheese.config()` will print some corresponding info messages. These info messages can be disabled via this option.                                                                                                                                                                           |\n| `showCheeseIcon`           | `boolean \\| (who: Who, logLevel: LogLevel) =\u003e boolean`                                                                                                                                                                                                                                       | `true`                                                                                                                                       | Decides whether log messages show the 🧀 icon or not.                                                                                                                                                                                                                                                                                  |\n| `showDate`                 | `boolean \\| (who: Who, logLevel: LogLevel) =\u003e boolean`                                                                                                                                                                                                                                       | `true`                                                                                                                                       | Decides whether log messages show date / timestamp or not.                                                                                                                                                                                                                                                                             |\n| `showLogLevel`             | `boolean \\| (who: Who, logLevel: LogLevel) =\u003e boolean`                                                                                                                                                                                                                                       | `true`                                                                                                                                       | Decides whether log messages show the logLevel or not.                                                                                                                                                                                                                                                                                 |\n| `showOrigin`               | `boolean \\| (who: Who, logLevel: LogLevel) =\u003e boolean`                                                                                                                                                                                                                                       | `false`                                                                                                                                      | Decides whether log messages show the (stacktrace) origin or not.                                                                                                                                                                                                                                                                      |\n| `spaces`                   | `boolean \\| (who: Who, logLevel: LogLevel) =\u003e boolean`                                                                                                                                                                                                                                       | `true`                                                                                                                                       | Decides if there should be a space `\" \"` between individual log arguments or not. This only concerns args that would be printed on the same line.                                                                                                                                                                                      |\n| `table`                    | `boolean \\| (who: Who, logLevel: LogLevel) =\u003e boolean`                                                                                                                                                                                                                                       | `false`                                                                                                                                      | Via this option you can print messages in a \"table format\". Details can be seen [here](#example-print-tables).                                                                                                                                                                                                                         |\n| `tableOptions`             | `TableOptions \\| (who: Who, logLevel: LogLevel) =\u003e TableOptions`                                                                                                                                                                                                                             | `undefined`                                                                                                                                  | Via this option you can control some formatting details for the table printing. The following options are allowed: `outerBorder: string`, `innerBorder: string`, `rowSeparator: string` and `headerSeparator: string`.                                                                                                                 |\n\n## Available functions\n\n### Config function\n\n`config(cheeseConfig: CheeseConfig | ContextDependentCheeseConfig)`\n\n### Basic logging functions\n\n- `log(...args: any[])`\n- `info(...args: any[])`\n- `debug(...args: any[])`\n- `warn(...args: any[])`\n- `error(...args: any[])`\n- `_log(cheeseConfig: CheeseConfig, ...args: any[])`\n- `_info(cheeseConfig: CheeseConfig, ...args: any[])`\n- `_debug(cheeseConfig: CheeseConfig, ...args: any[])`\n- `_warn(cheeseConfig: CheeseConfig, ...args: any[])`\n- `_error(cheeseConfig: CheeseConfig, ...args: any[])`\n- `log_(...args: any[], cheeseConfig: CheeseConfig)`\n- `info_(...args: any[], cheeseConfig: CheeseConfig)`\n- `debug_(...args: any[], cheeseConfig: CheeseConfig)`\n- `warn_(...args: any[], cheeseConfig: CheeseConfig)`\n- `error_(...args: any[], cheeseConfig: CheeseConfig)`\n\n### Built-in table functions\n\n- `logTable\u003cT\u003e(...args: T[])`\n- `infoTable\u003cT\u003e(...args: T[])`\n- `debugTable\u003cT\u003e(...args: T[])`\n- `warnTable\u003cT\u003e(...args: T[])`\n- `errorTable\u003cT\u003e(...args: T[])`\n- `_logTable\u003cT\u003e(cheeseConfig: CheeseConfig, ...args: T[])`\n- `_infoTable\u003cT\u003e(cheeseConfig: CheeseConfig, ...args: T[])`\n- `_debugTable\u003cT\u003e(cheeseConfig: CheeseConfig, ...args: T[])`\n- `_warnTable\u003cT\u003e(cheeseConfig: CheeseConfig, ...args: T[])`\n- `_errorTable\u003cT\u003e(cheeseConfig: CheeseConfig, ...args: T[])`\n- `logTable_\u003cT\u003e(...args: T[], cheeseConfig: CheeseConfig)`\n- `infoTable_\u003cT\u003e(...args: T[], cheeseConfig: CheeseConfig)`\n- `debugTable_\u003cT\u003e(...args: T[], cheeseConfig: CheeseConfig)`\n- `warnTable_\u003cT\u003e(...args: T[], cheeseConfig: CheeseConfig)`\n- `errorTable_\u003cT\u003e(...args: T[], cheeseConfig: CheeseConfig)`\n\n^ providing `\u003cT\u003e` is optional and allows you to define the required data structure as needed to avoid bugs. After all every object in the provided array(s) need to have the same props.\n\n### Built-in color functions\n\n- `logBlack(...args: any[])`\n- `infoBlack(...args: any[])`\n- `debugBlack(...args: any[])`\n- `warnBlack(...args: any[])`\n- `errorBlack(...args: any[])`\n- `_logBlack(cheeseConfig: CheeseConfig, ...args: any[])`\n- `_infoBlack(cheeseConfig: CheeseConfig, ...args: any[])`\n- `_debugBlack(cheeseConfig: CheeseConfig, ...args: any[])`\n- `_warnBlack(cheeseConfig: CheeseConfig, ...args: any[])`\n- `_errorBlack(cheeseConfig: CheeseConfig, ...args: any[])`\n- `logBlack_(...args: any[], cheeseConfig: CheeseConfig)`\n- `infoBlack_(...args: any[], cheeseConfig: CheeseConfig)`\n- `debugBlack_(...args: any[], cheeseConfig: CheeseConfig)`\n- `warnBlack_(...args: any[], cheeseConfig: CheeseConfig)`\n- `errorBlack_(...args: any[], cheeseConfig: CheeseConfig)`\n- `logWhite(...args: any[])`\n- etc.\n\n^ this works with the following colors: `Black`, `White`, `Gray`, `Lightgray`, `Blue`, `Lightblue`, `Cyan`, `Lightcyan`, `Red`, `Lightred`, `Green`, `Lightgreen`, `Yellow`, `Lightyellow`, `Magenta`, `Lightmagenta`\n\n## Live Demos\n\nAll the live demos shown above can be found collected [here](https://stackblitz.com/@maks-io/collections/cheese-log).\n\nAnother very basic usage example - this time as part of a **react native app** though - can be found [in this expo snack](https://snack.expo.dev/@maks-io/cheese-log-demo). Open your browser console there to see the log output from cheese-log. Note that it is only visible if you run the snack for the web platform though!\n\n## Open tasks / ideas\n\n- add unit tests\n- grouping functionalities\n- (async) hook functionality to allow sending logs to external services etc.\n\n## Miscellaneous\n\nVarious videos for this library [can be found here](https://www.youtube.com/watch?v=WR0qGktPVys\u0026list=PLz7X-_iH1H1EInL1zYQnv2akysVwn5L7f\u0026pp=iAQB). I am always happy if you pay me a visit on [my channel](https://www.youtube.com/@maks-io)!\n\n## If you enjoy using this...\n\n\u003ca href=\"https://www.buymeacoffee.com/maks_io\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" style=\"height: 48px !important;\" \u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaks-io%2Fcheese-log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaks-io%2Fcheese-log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaks-io%2Fcheese-log/lists"}