A lightweight, dependency-free logging library for Bun.js and Node.js – featuring emoji support, styled output, contextual logging, and high-performance stdout logging.
npm install @pbrgld/loggify!Status
!TypeScript
!license
!Bun.js
!Node >=18
!npm (scoped)
!npm downloads
!Made with love
> ⚠️ Project Status: Early Development ⚠️
>
> 🚧 Warning: Loggify is currently in an early development stage.
> The version on the main branch is considered unstable and may change significantly.
>
> 🧪 Expect breaking changes as features are added and the API evolves.
>
> 🙌 Your feedback, bug reports, and contributions are highly appreciated!
> Help shape Loggify into a reliable and performant logging tool.
>
> ---
Loggify is a fast, zero-dependency logging library built for modern JavaScript and TypeScript runtimes – especially fun with Bun.js!
Designed for developers who want more expressive and structured logs without sacrificing performance, loggify brings a fresh logging experience using styled output, emoji-enhanced messages, and flushable contextual logs that keep related information together.
- ⚡ Zero dependencies – lightweight and fast by design
- 🧵 Context-aware logging – group related logs and flush them together
- 🖨️ Uses stdout instead of console.log – for faster, cleaner output
- 🎨 Styled text output – control colors, formatting, and visibility
- 🕵️ Caller info support – trace logs back to where they were triggered
- 🕒 Customizable timestamps – add or remove as needed
- 😎 Emoji-based or text-based tags – switch as you like
- 🔌 Native Grafana Loki Support - go beyond console logging and push your logs to GrafanaLoki
- 🔧 Built to play nicely with Bun.js – but works with Node.js too!
You can install Loggify using either bun or npm:
``bash`
bun add @pbrgld/loggify
`bash`
npm install @pbrgld/loggify
Loggify works seamlessly with both TypeScript and JavaScript projects.
`ts
import Loggify from "@pbrgld/loggify";
const loggify: Loggify = new Loggify();
loggify.console("Hello world");
`
In the most simplest way, use the console method and provide a string as message to be sent to the console. As second parameter you can define a log type e.g. "okay", "success", "warn", "error" or the identifier for an emoji:
`ts`
loggify.console("Hello world", "rocket");
> 🧠 Note: Constructor Defaults & Auto-Configuration
>
> If the constructor is called without any arguments, a comprehensive default initialization is applied.
> This ensures that Loggify is fully functional out of the box, using sensible defaults for context management, output styling, and performance-optimized logging behavior.
> The defaults settings are:
>
> - Show log type as emoji
> - Log timestamp as time only
> - Show app's current memory consumption: Heap used, Heap total and total memory allocation in memors (rss)
> - Caller information (shows file as well as line and eventually function from where this log informtaion has been triggered from)
> - Followed by the message provided
You can configure Loggify by passing an options object to the constructor.
This allows you to customize the logger’s behavior to fit your project’s structure, output preferences, and runtime environment.
The available parameters are well-typed and fully documented through TypeScript definitions – so you can rely on auto-completion and inline hints in modern editors to explore all configuration options.
Simply pass the options you need – and omit the rest. Loggify applies sensible defaults for any parameters you leave out.
`ts`
const loggify: Loggify = new Loggify({
logCallerInformation: false,
logMemoryUsage: false,
logTimestamp: {
enabled: true,
mode: "dateTime",
},
});
!Output: removed caller information and memory usage via constructor
> 👆 Hint: This is an example, how to set the parameters in the constructor to remove caller information and memory usage and log the timestamp in date-time mode.
#### 🔕 Init class in silent mode
By default, Loggify prints informative initialization details when a new instance is created. This includes:
- The logger’s internal setup status
- The name of the class
- The currently installed version of Loggify
This startup log provides transparency about the logging environment and is especially useful during development or debugging.
However, if you prefer a completely silent initialization, you can disable this behavior using the initSilent parameter:
`ts`
const loggify: Loggify = new Loggify({ initSilent: true });
!Output: hide init information
Loggify supports inline styling and emoji enhancements directly within your message strings, using a simple and expressive tag syntax inspired by HTML.
To apply styling or emojis, use square brackets followed by a type (ansi or emoji) and a colon-separated value.
#### Syntax
- [ansi: