logftz


Namelogftz JSON
Version 3.0.0 PyPI version JSON
download
home_pagehttps://github.com/stdeson/logftz
SummaryA timezone-configurable logging package based on loguru with Shanghai timezone as default
upload_time2025-08-18 11:41:54
maintainerNone
docs_urlNone
authorstdeson
requires_python>=3.7
licenseNone
keywords logging loguru timezone configurable international
VCS
bugtrack_url
requirements loguru pytz
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # LogFtz - Timezone-Configurable Logging Package

A Python logging package based on loguru with configurable timezone support. Defaults to Shanghai timezone (Asia/Shanghai) but allows users to set any timezone.

## Features

- 🕐 Configurable timezone support (defaults to Asia/Shanghai)
- 📝 Clean log format: `MM-DD HH:mm:ss|LEVEL|MESSAGE`
- 📁 Automatic daily log file rotation
- 🗂️ Automatic retention of last 3 days of log files
- 🚀 Built on high-performance loguru library
- 🌍 International support with English interface

## Installation

### Install dependencies

```bash
pip install -r requirements.txt
```

## Usage

### Basic Usage

```python
from logftz import logger

# Log with different levels
logger.info("This is an info message")
logger.warning("This is a warning message")
logger.error("This is an error message")
logger.debug("This is a debug message")
```

### Timezone Configuration

```python
from logftz import logger, set_timezone

# Set timezone globally
set_timezone('UTC')
logger.info("This message uses UTC timezone")

# Set to New York timezone
set_timezone('America/New_York')
logger.info("This message uses New York timezone")

# Back to Shanghai timezone (default)
set_timezone('Asia/Shanghai')
logger.info("This message uses Shanghai timezone")
```

### Advanced Usage with Custom Configuration

```python
from logftz import LoggerConfig

# Create a custom logger configuration
config = LoggerConfig(timezone='Europe/London')

# Change timezone later
config.set_timezone('Asia/Tokyo')
```

### Log Output Example

```
12-25 14:30:15|INFO|This is an info message
12-25 14:30:16|WARNING|This is a warning message
12-25 14:30:17|ERROR|This is an error message
```

## Configuration

- **Default Timezone**: Asia/Shanghai
- **Log Level**: INFO and above
- **File Path**: `logs/YYYY-MM-DD.log`
- **Rotation**: Daily rotation
- **Retention**: Keep last 3 days of log files
- **Format**: `MM-DD HH:mm:ss|LEVEL|MESSAGE`

## Supported Timezones

You can use any timezone supported by pytz, including:

- `UTC`
- `Asia/Shanghai`
- `Asia/Tokyo`
- `Europe/London`
- `America/New_York`
- `America/Los_Angeles`
- And many more...

## Project Structure

```
logftz/
├── logftz/
│   ├── __init__.py    # Package initialization and public API
│   └── log.py         # Core logging configuration
├── setup.py           # Installation configuration
├── requirements.txt   # Dependencies
└── README.md         # Documentation
```

## Dependencies

- loguru >= 0.6.0
- pytz >= 2021.1

## API Reference

### Functions

- `set_timezone(timezone: str)`: Set the global timezone for logging

### Classes

- `LoggerConfig(timezone: str = 'Asia/Shanghai')`: Create a custom logger configuration
  - `set_timezone(timezone: str)`: Change the timezone for this configuration

### Variables

- `logger`: The main logger instance (loguru logger)

## License

MIT License

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/stdeson/logftz",
    "name": "logftz",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "logging loguru timezone configurable international",
    "author": "stdeson",
    "author_email": "stdeson@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/6e/2b/179cae7043727ab2b0a45c8a5c53c2c8c0d0784d2b80f68bbfa29797e688/logftz-3.0.0.tar.gz",
    "platform": null,
    "description": "# LogFtz - Timezone-Configurable Logging Package\n\nA Python logging package based on loguru with configurable timezone support. Defaults to Shanghai timezone (Asia/Shanghai) but allows users to set any timezone.\n\n## Features\n\n- \ud83d\udd50 Configurable timezone support (defaults to Asia/Shanghai)\n- \ud83d\udcdd Clean log format: `MM-DD HH:mm:ss|LEVEL|MESSAGE`\n- \ud83d\udcc1 Automatic daily log file rotation\n- \ud83d\uddc2\ufe0f Automatic retention of last 3 days of log files\n- \ud83d\ude80 Built on high-performance loguru library\n- \ud83c\udf0d International support with English interface\n\n## Installation\n\n### Install dependencies\n\n```bash\npip install -r requirements.txt\n```\n\n## Usage\n\n### Basic Usage\n\n```python\nfrom logftz import logger\n\n# Log with different levels\nlogger.info(\"This is an info message\")\nlogger.warning(\"This is a warning message\")\nlogger.error(\"This is an error message\")\nlogger.debug(\"This is a debug message\")\n```\n\n### Timezone Configuration\n\n```python\nfrom logftz import logger, set_timezone\n\n# Set timezone globally\nset_timezone('UTC')\nlogger.info(\"This message uses UTC timezone\")\n\n# Set to New York timezone\nset_timezone('America/New_York')\nlogger.info(\"This message uses New York timezone\")\n\n# Back to Shanghai timezone (default)\nset_timezone('Asia/Shanghai')\nlogger.info(\"This message uses Shanghai timezone\")\n```\n\n### Advanced Usage with Custom Configuration\n\n```python\nfrom logftz import LoggerConfig\n\n# Create a custom logger configuration\nconfig = LoggerConfig(timezone='Europe/London')\n\n# Change timezone later\nconfig.set_timezone('Asia/Tokyo')\n```\n\n### Log Output Example\n\n```\n12-25 14:30:15|INFO|This is an info message\n12-25 14:30:16|WARNING|This is a warning message\n12-25 14:30:17|ERROR|This is an error message\n```\n\n## Configuration\n\n- **Default Timezone**: Asia/Shanghai\n- **Log Level**: INFO and above\n- **File Path**: `logs/YYYY-MM-DD.log`\n- **Rotation**: Daily rotation\n- **Retention**: Keep last 3 days of log files\n- **Format**: `MM-DD HH:mm:ss|LEVEL|MESSAGE`\n\n## Supported Timezones\n\nYou can use any timezone supported by pytz, including:\n\n- `UTC`\n- `Asia/Shanghai`\n- `Asia/Tokyo`\n- `Europe/London`\n- `America/New_York`\n- `America/Los_Angeles`\n- And many more...\n\n## Project Structure\n\n```\nlogftz/\n\u251c\u2500\u2500 logftz/\n\u2502   \u251c\u2500\u2500 __init__.py    # Package initialization and public API\n\u2502   \u2514\u2500\u2500 log.py         # Core logging configuration\n\u251c\u2500\u2500 setup.py           # Installation configuration\n\u251c\u2500\u2500 requirements.txt   # Dependencies\n\u2514\u2500\u2500 README.md         # Documentation\n```\n\n## Dependencies\n\n- loguru >= 0.6.0\n- pytz >= 2021.1\n\n## API Reference\n\n### Functions\n\n- `set_timezone(timezone: str)`: Set the global timezone for logging\n\n### Classes\n\n- `LoggerConfig(timezone: str = 'Asia/Shanghai')`: Create a custom logger configuration\n  - `set_timezone(timezone: str)`: Change the timezone for this configuration\n\n### Variables\n\n- `logger`: The main logger instance (loguru logger)\n\n## License\n\nMIT License\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A timezone-configurable logging package based on loguru with Shanghai timezone as default",
    "version": "3.0.0",
    "project_urls": {
        "Homepage": "https://github.com/stdeson/logftz"
    },
    "split_keywords": [
        "logging",
        "loguru",
        "timezone",
        "configurable",
        "international"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6e2b179cae7043727ab2b0a45c8a5c53c2c8c0d0784d2b80f68bbfa29797e688",
                "md5": "f1b61bb74bd66dbf3986f8e8c6a70107",
                "sha256": "3166902bdd10ada98b009eaa54197ca07fa4130a33974f29fc941f541080e250"
            },
            "downloads": -1,
            "filename": "logftz-3.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f1b61bb74bd66dbf3986f8e8c6a70107",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 6031,
            "upload_time": "2025-08-18T11:41:54",
            "upload_time_iso_8601": "2025-08-18T11:41:54.559610Z",
            "url": "https://files.pythonhosted.org/packages/6e/2b/179cae7043727ab2b0a45c8a5c53c2c8c0d0784d2b80f68bbfa29797e688/logftz-3.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-18 11:41:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "stdeson",
    "github_project": "logftz",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "loguru",
            "specs": [
                [
                    ">=",
                    "0.6.0"
                ]
            ]
        },
        {
            "name": "pytz",
            "specs": [
                [
                    ">=",
                    "2021.1"
                ]
            ]
        }
    ],
    "lcname": "logftz"
}
        
Elapsed time: 1.50735s