PHPackages                             putyourlightson/craft-log-to-file - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. putyourlightson/craft-log-to-file

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

putyourlightson/craft-log-to-file
=================================

Logs messages to a specific log file for Craft CMS.

1.2.3(5y ago)29368.0k↓50%55MITPHP

Since Apr 24Pushed 3y ago2 watchersCompare

[ Source](https://github.com/putyourlightson/craft-log-to-file)[ Packagist](https://packagist.org/packages/putyourlightson/craft-log-to-file)[ Docs](https://github.com/putyourlightson/craft-log-to-file)[ RSS](/packages/putyourlightson-craft-log-to-file/feed)WikiDiscussions v1 Synced 1mo ago

READMEChangelogDependencies (2)Versions (9)Used By (5)

Log To File Helper for Craft CMS 3
==================================

[](#log-to-file-helper-for-craft-cms-3)

The Log To File helper provides a simple way for logging messages to a specific file. It is intended to be used a helper class for modules and plugins in [Craft CMS](https://craftcms.com/).

Craft 4 Support
---------------

[](#craft-4-support)

This package will *not* be updated for use with Craft 4. Instead, we recommend you use a custom Monolog log target to achieve a similar (better) result, as explained in

Requirements
------------

[](#requirements)

This component requires Craft CMS 3.0.0 or later.

Usage
-----

[](#usage)

Install it manually using composer:

```
composer require putyourlightson/craft-log-to-file
```

Or add it as a dependency to your plugin:

```
"require": {
    "putyourlightson/craft-log-to-file": "^1.0.0"
},

```

Then you can write messages to a log file as follows.

```
use putyourlightson\logtofile\LogToFile;

$message = 'The message to log.';

// Log as info
LogToFile::info($message, 'my-plugin-handle');

// Log as error
LogToFile::error($message, 'my-plugin-handle');

// Log as Yii message level
LogToFile::log($message, 'my-plugin-handle', 'error');

// Log as custom category
LogToFile::log($message, 'my-plugin-handle', 'custom-category');
```

The result is a concise log file that contains messages relevant to your module/plugin only.

### File: `my-plugin-handle.log`

[](#file-my-plugin-handlelog)

```
2019-04-24 09:47:14 [info] Notification email sent to user #34.
2019-04-24 17:53:45 [info] Notification email sent to user #56.
2019-04-24 19:45:52 [error] Template `notification` not found.
2019-04-24 19:56:13 [debug] Template `notification` could not be rendered.

```

License
-------

[](#license)

This software is licensed for free under the MIT License.

---

Created by [PutYourLightsOn](https://putyourlightson.com/).

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~150 days

Recently: every ~192 days

Total

9

Last Release

1371d ago

Major Versions

1.2.3 → 2.0.0-alpha.12022-03-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/59428c6783d02d74c8778d9953ba84c35d3877ece53f5eb393689c052a9c97e4?d=identicon)[putyourlightson](/maintainers/putyourlightson)

---

Top Contributors

[![bencroker](https://avatars.githubusercontent.com/u/57572400?v=4)](https://github.com/bencroker "bencroker (4 commits)")[![brianjhanson](https://avatars.githubusercontent.com/u/1843073?v=4)](https://github.com/brianjhanson "brianjhanson (1 commits)")[![engram-design](https://avatars.githubusercontent.com/u/1221575?v=4)](https://github.com/engram-design "engram-design (1 commits)")

---

Tags

logpluginfilecmsCraftcraftcms

### Embed Badge

![Health badge](/badges/putyourlightson-craft-log-to-file/health.svg)

```
[![Health](https://phpackages.com/badges/putyourlightson-craft-log-to-file/health.svg)](https://phpackages.com/packages/putyourlightson-craft-log-to-file)
```

###  Alternatives

[lukeyouell/craft-sentry

Error tracking that helps developers monitor and fix crashes in real time. Iterate continuously. Boost efficiency. Improve user experience.

17123.4k1](/packages/lukeyouell-craft-sentry)[superbig/craft-audit

Log adding/updating/deleting of elements

2053.6k](/packages/superbig-craft-audit)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
